Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create program in java. Must be done in mutiple methods. Use random class, int arrays. Write a program to simulate a lottery game. Generate a

Create program in java. Must be done in mutiple methods. Use random class, int arrays.

image text in transcribedimage text in transcribed

Write a program to simulate a lottery game. Generate a random 10 digit number and then prompt the user to enter a 10 digit number. Both numbers should be stored in an array where each element of the array is one digit of the number. The total jackpot is $100,000. You should compare the user's guess to the randomly generated lottery number and give the user a percentage of the winnings based on how many digits they guessed correctly. For example: if the winning number is 5936577294 and the user guesses 5473077294 they would get 60% of the winnings since they guessed 6/10 numbers correctly. A digit in the user's number is correct if it matches the corresponding number in the same digit position as the winning number. NOTE: To get credit for this problem you must store each number in an array as described above, and use these arrays to complete the assignment. Sample Output: Enter a 10 digit lottery number: 5473077294 Winning Number: 0456180747 User Guess: 5473077294

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago