Question: This is java coding CPT 236 Programming Project 5 Project 5: Chapter 9 - Arrays Problem Definition: Write a lottery program that allows players to

This is java coding  This is java coding CPT 236 Programming Project 5 Project 5:
Chapter 9 - Arrays Problem Definition: Write a lottery program that allows

CPT 236 Programming Project 5 Project 5: Chapter 9 - Arrays Problem Definition: Write a lottery program that allows players to select 4 numbers which attempt to match a set of random winning numbers generated by the computer. Required parameters for this problem are: 1. Four (4) random numbers should be generated by the computer and four (4) numbers should be selected by the player. 2. The computer generated numbers and the player selected numbers should be unique, no repeated numbers allowed. 3. Allow only numbers between 1 and 25 to be generated by the computer as well as selected by the player, 4. Ordering of the numbers selected by the player should not be required. 5. After the player selects their guesses, the number of matches (any player selection equals any computer generated number) should be totaled and a message printed with the following winning payout information (per each play) match 0. SO payout; match 1, $1 payout: match 2. $5 payout: match 3 $20 payout; match 4, $100 payout. Also, assuming that a play costs $2, print how much the player has made or lost for the play. The program should use the Math.random() method to generate the four (4), unique, random lottery numbers then the player should be queried to enter four (4). unique, guesses. Be sure and use Math.random correctly in order to generate an integer between 1 and 25: the random method generates a decimal number between 0.0 and 10. Use an appropriate loop and an array to store the unique random numbers generated by the computer. Also, use an appropriate loop and an array to store the unique numbers selected by the player, Some suggestions, hints, concerning the program For step 2, because the numbers should be unique, do not generate a random number (or query the player for a selected number) and assign it to an array location. Assign the number to a temporary variable then check all previous numbers generated (or check all previous numbers selected) to make sure the number is truly unique. Put this little process inside a loop which will execute until a unique number is generated (or selected) For step 3, make sure the generated random number (or the player selected number) is between 1 and 25. The Math.random() method can be scaled and shifted with a formula. The player selected number will have to be checked with an if statement and this little process placed inside an appropriate loop which will execute until a correct number is selected For step 4 (and the program in general), the numbers are not required to be ordered. However, you may find it very easy to work with sorted arrays. For step 5, systematically go through all the players selections, checking each one against all the computer generated numbers, incrementing the total when an exact match is found. Since the numbers are unique. You will not have any over or under counts. Once you have a total use a case statement to print out the appropriate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!