473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hard lottery project.

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
4 1531
Ganon11
3,652 Expert 2GB
In which language? .
Mar 27 '08 #2
r035198x
13,262 8TB
.....Any one has an idea of doing this?
... and what ideas have you got for it so far?
Mar 27 '08 #3
JosAH
11,448 Expert 8TB
@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
1q2w3e
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

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

Similar topics

6
by: moi | last post by:
hi, i have an assignment to put 6 pseudo random numbers into an array to simulate drawing 6 lottery numbers between 1-49. the code i have to do this so far is listed below. i dont think its far...
0
by: custom | last post by:
First off, I don't know very much about programming. My problem is, I have a lottery program written in 1989, and I need minor changes made to it so I can use it. I did find the Borland name, but...
0
by: NTL Newsgroups | last post by:
Hi, I've written a lottery programme in PHP that selects 10 winners a week from approximately 18,000 shares. The problem I have is that of the ten winners one week the same share number was...
11
by: Kevin Williamson | last post by:
Hi, I've written a lottery programme in PHP that selects 10 winners a week from approximately 18,000 shares. The problem I have is that of the ten winners one week the same share number was...
3
by: dazza2122 | last post by:
I want to design a program to genarate lottery number the number have to be unique and be 0 to 49. Can anybody shed some sort of light on the code it would take
8
by: Miktor | last post by:
I'm trying to write a lottery number generator for the uk national lottery. Any clues where I'm going wrong? #include <cstdlib> #include <iostream> using namespace std; int main ()
0
by: pokerislotto | last post by:
We invent a method called pokerization of lottery to play lottery strategically. This is the website : http://lottoispoker.bravehost.com/ We deal with UK National Lottery, Canada Lotto 6/49 and...
8
by: ImortalSorrow | last post by:
Hey, I'm quite new in programing so need some help with this lottery program I'm making. What I'm trying to do is very simple, simulate a lottery but my effords are in vain since when I'm compiling...
0
by: | last post by:
UK NATIONAL LOTTERY DESK Reference No: ACCU/2007-200 Good day Winner No: A333/ZZ5, We use this medium to notify you of the lottery prize won by your email address, in this year's edition of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.