By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

Hard lottery project.

P: 2
You are to create a lottery game program that allows a user to simulate playing the lottery. In
this lottery game, the winning number combination comprises four unique numbers, each in
the range of 1 to 40
A winning ticket will match from one to four numbers and pay-out based on the following
schedule: 1 number matched = $2.00, 2 numbers matched = $20.00, 3 numbers matched
$100.00, and 4 numbers matched = $1,000.
Your lottery game program should allow the user to:
1. purchase and store from 1 to 5 lottery tickets. The numbers on each ticket are
determined randomly. A single ticket cannot have duplicate numbers.
2. print the purchased tickets in the following format (this example shows five tickets):
Ticket 1: 21-17-22-30
Ticket 2: 16-5-42-25
Ticket 3: 40-11-28-7
Ticket 4: 34-8-16-1
Ticket 5: 26-37-15-40
3. have the program choose and print the winning lottery number in the following format:
Winning Numbers: 16-42-8-1
4. check the tickets purchased against the winning number and print out the results as
follows:
Ticket 1: 2-17-22-30
1 match: 17
Ticket total $2.00
Ticket 2: 16-5-42-25
2 matches: 16, 42
Ticket total: $20.00
Ticket 3: 40-11-28-72
no matches
Ticket total: $0.00
Ticket 4: 34-8-16-1
1 match: 16
Ticket total: $2.00
Ticket 5: 26-37-15-40
no matches
Ticket total: $0.00
Total Winnings: $24.00

Any one has an idea of doing this?
Mar 27 '08 #1
Share this Question
Share on Google+
4 Replies


Ganon11
Expert 2.5K+
P: 3,652
In which language? .
Mar 27 '08 #2

10K+
P: 13,264
.....Any one has an idea of doing this?
... and what ideas have you got for it so far?
Mar 27 '08 #3

Expert 10K+
P: 11,448
@OP: what is hard about it? Given the assignment text the code almost writes
itself, you just have to put the description to source code.

kind regards,

Jos
Mar 27 '08 #4

P: 2
My problem is how to do step 4:
4. check the tickets purchased against the winning number and print out the results as
follows:
Ticket 1: 2-17-22-30
1 match: 17
Ticket total $2.00
Ticket 2: 16-5-42-25
2 matches: 16, 42
Ticket total: $20.00
Ticket 3: 40-11-28-72
no matches
Ticket total: $0.00
Ticket 4: 34-8-16-1
1 match: 16
Ticket total: $2.00
Ticket 5: 26-37-15-40
no matches
Ticket total: $0.00
Total Winnings: $24.00
I need some hints.
Mar 28 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.