Question: Hello this a java lab question I solved but professor says you have to implement the additional notes given in the assignment. So I want
Prompt: Write a program that will accept 5 positive numbers from the user between (0,9) inclusive for a lottery ticket. Implement error checking to ensure the numbers are between the specified range. If any input is outside of the range immediately exit from the program notifying the user there was an invalid input. Generate 5 random numbers between (0,9) inclusive. Display the generated digits to the console. Compare each number the user entered in order with the generated numbers. Keep track of the total matching numbers. Based on the total matching numbers output the following: Less than 3 - "Non winning lottery ticket" 3- "Won $500" 4 - "Won "$50,000" 5-Won-"$500,000" Additional Notes: The random generated numbers must be of type int When reading in user input for 5 numbers you must separate with a space for each digit, otherwise it gets read in as one 5 digits number Bonus Points: When checking for error handling do not use 5 separate if statements, use only OR (II) and AND (88) operations in a single if statement. Sample Runs: Enter 5 numbers for the lottery: 15 5 7 8 Generated 5 digit number: 14192 Non winning ticket Enter 5 numbers for the lottery: 1 4 10 -4 2 Invalid input. Exiting
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
