Question
Hi, can I have help with the following question? I need an answer that follows the instructions as closely as possible. Write a program that
Hi, can I have help with the following question? I need an answer that follows the instructions as closely as possible.
Write a program that simulates a number-matching game, wherein, based on the value that the user enters, three numbers are generated randomly and printed side by side.
* The program should examine the three generated numbers on the following conditions:
- if the three generated numbers match, then the user will win $500;
- if two of the three random numbers match, then the user will win $200;
- if there is no matching number, the user will not win anything.
* The program must record the user's earnings throughout the game and display their total winnings at the end.
* Once the first user has finished playing, the program should allow a new player to begin the game.
SAMPLE OUTPUT:
* The program must have multiple methods. In a new Java class, the following methods should be implemented in this order:
- public static int getRandNum (Random rand, int max)
- public static int match (int n1, int n2, int n3)
- public static void description ()
- public static void play (Random rand)
- public static void main (String [] args)
* Describe in block comments what each method does.
PROGRAM TEMPLATE:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started