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?
4 1548 Ganon11 3,652
Recognized Expert Specialist
.....Any one has an idea of doing this?
... and what ideas have you got for it so far?
JosAH 11,448
Recognized Expert MVP
@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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 off. im getting a recurring
error regarding the syntax of my main() function argument calling in
lottery_numbers array. so any help as to whats glaringly going wrong
here?? oh and some brief guidance on whats the easiest way to sort the
numbers...
|
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 other than that, I know nothing else. I think a simple find and replace will work, BUT I don't know the prrocess.
Can anyone tell me what I need to do? What can I do to be able to read the code so I can change the values to what I need? Any help...
|
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 drawn the next week and an adjacent share number the
following week (that just happened to be owned by the same member)
The program is now being looked at suspisciously.
|
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 drawn the next week and an adjacent share number the
following week (that just happened to be owned by the same member)
The program is now being looked at suspisciously.
|
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
| |
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 ()
|
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 Singaporepools
TOTO 6/45 for the moment.
|
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 it, it says that there are 100 errors ... -.- The code is right here:
class lottery {
public static void main (Strings args){
int ball1;
int ball2;
int ball3;
int ball4;
|
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 UK National Lottery. Kindly contact Our payment Officer, below via email:
Mr. Graham Wilbert,
Tel: +44 704 575 9999
Email: grahamwilbert_uknldesk@yahoo.co.uk
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |