CMSC 201 B & F Lottery Out: Wednesday 9/22/99 |
The objective of this assignment is to get you started writing programs in C in the UNIX environment. This project will give you practice using loops, and mixing data types.
B&F Lottery Inc., is a ficticious private lottery company that gives one the opportunity to play three different lottery games. These lottery games are "Pick-3", "Pick-4" and "Lotto6".
"Pick-3" is a game in which the player chooses a 3-digit number between 000 and 999. Pick-3 drawings are held Tuesday and Thursday at 11:00 PM. If the number selected by the player matches the number drawn, the player wins $500.00 for each $0.50 wager. Pick-3 tickets may be purchased for $0.50 to $5.00 per drawing in $0.50 increments, and for 1 to 7 drawings.
"Pick-4" is a essentially the same game as Pick-3, except that the player chooses a 4-digit number between 0000 and 9999. Pick-4 drawings are held Monday and Wednesday at 11:00 PM. If the number selected by the player matches the number drawn, the player wins $500.00 for each $0.50 wager. Pick-4 tickets may be purchased for $0.50 to $5.00 per drawing in $0.50 increments, and for 1 to 7 drawings.
"Lotto6" is a game in which the player chooses 6 numbers between 1 and 49. Lotto6 drawings are held Saturday at 11:00 PM. The player wins by matching the 6 numbers he selected with the 6 numbers drawn. The player wins according to the following table:
Number of Matches | Payout |
3 of 6 | $2 |
4 of 6 | $40 |
5 of 6 | $1,500 |
6 of 6 | $1,000,000 |
Your task is to write a program that inputs ticket data (game, wager amount per draw and number of drawings), validates the ticket data (dependent on the game) then calculates the total ticket cost.
For this program, the following game numbers MUST be used:
Although your output need not be identical to the above, all information (including the greeting) must be present.
Your C source code file for this project MUST be called proj1.c.
To submit your project, type the following at the Unix prompt.
Note that the project name starts with uppercase 'P'.
submit cs201 Proj1 proj1.c
To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.
submitls cs201 Proj1