language is JAVA PLEASE ADD COMMENTS TO EACH LINE OF CODE SO I CAN EASILY UNDERSTAND IT OTHERWISE NOT UPVOTE. THANK YOU. */ Build a simple lottery program that asks the user to input six numbers, prints those numbers, spins 6 random lottery numbers, and compares them to the user's chosen number. The prize is “1000” if the selected lottery numbers match at least 3 of the 6 created numbers. The prize is “2000” if it matches 4 numbers. The prize is “4000” if it matches 5 numbers. The prize is "8000" i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

/*The programming language is JAVA
PLEASE ADD COMMENTS TO EACH LINE OF CODE SO I CAN EASILY UNDERSTAND IT OTHERWISE NOT UPVOTE. THANK YOU. */

Build a simple lottery program that asks the user to input six numbers, prints those numbers, spins 6 random lottery numbers, and compares them to the user's chosen number. The prize is “1000” if the selected lottery numbers match at least 3 of the 6 created numbers. The prize is “2000” if it matches 4 numbers. The prize is “4000” if it matches 5 numbers. The prize is "8000" if it matches all of the numbers. The prize is "0" if it matches ≤2 winning numbers.
Make 2 classes that meet the following criteria:
1. The first class asks input from the user and then shows the result. The result(int num) method must determine which reward is appropriate for the user and show the outcome.
2. The lottery function must be included in the second class. This should include the spin(), setwinninglottery(), and compare methods (int num[ ], int lot[]).
3. The spin() method creates 6 random lottery winning numbers ranging from 1 to 45.
4. Repeated values are not acceptable. It's important to note that this method only returns one lottery number each call.
6. Sets the six lottery winning number from a spin with the setwinninglottery() method ().
7. To compare the user's six selected numbers with the six winning lottery numbers, a compare(int num[ ]) method must be defined. This determines the quantity of numbers that matches then returns it to the main class.
Sample Output
Choose six numbers: 6 9 44 23 31 18
Initiating Winning Numbers…
Winning Lottery numbers: 31 1 9 45 43 18
Number of Matches: 3
Your reward is: USD 1000

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY