Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:10, chiah
Type the correct answer in the box. spell all words correctly. which technology should andrea use? andrea owns a potato chips manufacturing unit. she has been getting complaints about the quality of the chips. she knows her product is good. she realizes that she needs to change the way the chips are packaged. she should use technology, which uses gases, such as carbon dioxide or argon, to create an air cushion, which improves the shelf life of products.
Answers: 2
image
Computers and Technology, 21.06.2019 18:20, dinosaur10
Geneva’s manager would like to see some additional information to make sales decisions. enter a formula in cell j4 using the if function to it whether or not the item beaded earrings should go on sale. it will go on sale if its current sales rank (in cell g4) is 8th or lower. (hint: if the cell value is greater than or equal to 8, it will go on sale.)if this condition is true, the item will go on sale. (hint: the if_true value should be “yes”.)if this condition is false, the item doesn’t need to go on sale. (hint: the if_false value should be “-”.)copy the formula created in cell j4 to the range j5: j14
Answers: 2
image
Computers and Technology, 21.06.2019 23:00, pinkyglitter2696
Give an example of a case where a two-way handshake to establish a connection could leave one side of the connection live while the other side does not believe there is a connection.
Answers: 1
image
Computers and Technology, 22.06.2019 17:00, silvijaaa
The two main ways in which marketers address the competition with their strategies are by satisfying a need better than a competition and by
Answers: 2
Do you know the correct answer?
You’re going to write a program that models the littleton city lotto (not a real lotto game). the pr...

Questions in other subjects: