subject

You’re going to write a program that models the littleton city lotto (not a real lotto game). the program is going to allow to user to first select their lotto numbers. the program will then randomly generate the winning lotto numbers for the week and then check the winning numbers against the random ticket the user played in the lotto to see how many numbers the user guessed correctly.
the rules for lotto work as follows:
1. select 7 numbers between 1 and 40
2. twice every week 7 numbers are drawn at random
3. if a player matches all 7 numbers they win a million dollar prize
4. if a player matches 6 numbers they win $100,000
5. if a player matches 5 numbers they win $5,000
6. if a player matches 4 numbers they win $100.
7. if a player matches 3 numbers they win a free ticket.
your program should work as follows. (note i have listed some functions you need to include in your program – you may include other functions if you would like and they make your program more readable/efficient).
step 1:
create an array named userticket to hold each of the user’s lotto number selections.
create an array named winningnums to hold the winning lotto numbers.
step 2:
display the following menu:
littleton city lotto model:

1) play lotto
q) quit program
make a selection:
-if the selection is 1:
a. first ask the user their name and store it in an appropriate variable.
b. next, call a function named getlottopicks that asks the user to enter their 7 lotto number picks (selections) for the week. each of the user’s lotto picks should be stored in the userticket array. the lotto does not have duplicate numbers in it. find a way to not allow duplicate numbers to be picked by the user. you may want to create another function called noduplicates that checks to see if the user’s selection is already in the userticket array. if the user enters a number already in the array, ask them to enter another number until they enter one that is not a duplicate. this means the userticket array should contain no duplicate numbers.
c. next, call a function named genwinnums that randomly generates the winning lotto numbers for the week based on the rules stated above and stores the winning lotto numbers in the winningnums array (so you are going to fill the winningnums array with random numbers between 1 and 40). do not allow this function to generate duplicate winning numbers (if you design your noduplicates function above well you should be able to re-use it to check for duplicates in the winningnums array).
hint: there are two ways to avoid having duplicate numbers in an array. most of you will need to use the first method. the first method is to check the array after each number is generated or entered to make sure that number is not already in the array. if the number generated/entered is already in the array a new number should be generated/entered. the second method involves sorting and checking that the numbers next to each other in the array after the sort are not the same – if you have taken csis 130 and know how to sort an array you can use this method.
d. the next step is to check the user’s lotto ticket (represented by the userticket array) to see if they have won any prizes in the lotto game. check each number the userticket array to see if that number is in the winningnums array and count how many numbers are matched.
display a report similar to the following showing user’s lotto results – the example output below assumes the user entered a name of "julie" when the program started.
in the "winnings" section of the report
¨ display: jackpot - 1 million if all 7 numbers were correct
¨ display: great! - $100,000 if 6 numbers were correct
¨ display: lucky you! - $5,000 if 5 numbers were correct
¨ display: not bad - $100 if 4 numbers were correct
¨ display: free ticket if 3 numbers were correct
¨ display: sorry nothing if 2 or less numbers were correct
julie's lotto results

winning ticket numbers: 35 03 01 15 10 25 22
julie’s ticket : 33 15 02 06 21 20 19
results:

number matches: 1
winnings : sorry nothing
-if the selection is q: quit the program
-if the selection is not q and not 1: display an invalid selection message
allow the user to play lotto as many times as they would like.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:20
In what kind of attack can attackers make use of millions of computers under their control in an attack against a single server or network availability confidentiality integrity identity automated attack software? those who wrongfully disclose individually identifiable health information can be fined up to what amount per calendar year? single most expensive malicious attack hipaa what are script kiddies? advanced persistent threat security manager security engineer what level of security access should a computer user have to do their job what process describes using technology as a basis for controlling the access and usage of sensitive data? cybercriminal
Answers: 1
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
What is the biggest difference between section breaks and regular page breaks
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
You know the right answer?
You’re going to write a program that models the littleton city lotto (not a real lotto game). the pr...
Questions
question
Mathematics, 18.10.2019 11:30
question
Mathematics, 18.10.2019 11:30
Questions on the website: 13722363