Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 a java code which has implementation of the notes and instructions as given in the pic please. image text in transcribed
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

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 Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions