Homework 2
comp 125-609, Goldwasser
Due: 6:00pm Tuesday, September 21, 1999 (worth 5 points)
Late Option: if submitted between 6:00pm September 21 and 6:00pm September 28, you can recieve up to 3 of 5 points. No late homeworks will be accepted after 6:00pm September 28.
Purpose: More experience dealing with numbers, text and decision structures.
Overview: Precisely while we are having class next week, Sammy Sosa and Mark McGwire will be in Wrigley field trying to hit home runs, and thus putting more historic souvenirs into the crowd. A lucky fan who can catch one of these home run balls gets to keep it as a souvenir of the day at the park.

Or, as we have seen, the fan can choose to cash in on the home run mania and sell the ball for an enormous amount of money. Our job in this assignment is going to be to write a program which can estimate the value of the ball for resale.

The formula we will use for pricing a ball depends on which home run it was for the player that season. (That is people will pay more for home run #70 then for home run #4). So we will use the following equation: Price = Homerun Ball Number x Index Factor, where index factors are defined as:
Home Run Ball Number Index Factor
1-21 $1,250
22-30 $8,500
31-55 $11,000
56-66 $22,000
67-70 $34,000
> 70 $45,000


Overview: Your program must do all of the following:
  • Display the chart shown above using label(s) or picture box(es)
  • Have the user select which player's home run is being bought
  • Have the user enter the Home Run Number of the ball
  • Have a command button labeled "Purchase" such that when the user clicks on this button, your program displays an output message which includes all of the following information:
  • The name of the player (i.e., McGwire or Sosa)
  • The Home Run Number
  • The index factor which applies
  • The total price for the ball.
  • For example, a message may read "We are proud to sell Sammy Sosa's homerun ball 60. Because it has an index factor of $22,000, the total cost will be $1,320,000."

  • Incorrect Input: For this assignment you may assume that we have a nice user who enters acceptable input to your program. (eventually in this course, we will start to be concerned with how to react to users who say they want to buy homerun number 128.35)
    Extra Credit: Turn in such a home run ball from McGwire or Sosa. The amount of extra credit points awarded will also be based on a suitable index factor.

    Actually, for 1 point of extra credit, make your interface nicer by having the user use a ListBox when selecting the name of the player. You will have to learn how to use ListBox's on your own. They are discussed on page 267-269 of the textbook, and in the online help pages in Visual Basic.


    To submit your homework you should,
  • Print out your project as follows. Click "File". Click "Print". In the Range box, select "Current project". In the Print What box, click on all three of "Form Image", "Code" and "Form as Text".
  • Save your project and form to a floppy disk
  • Place the printouts and the floppy disk inside a large manilla envelope. Please make sure that your name appears on the envelope as well as the disk and the printouts.