Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

* 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:

image text in transcribed

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

Students also viewed these Databases questions

Question

Write formal and informal proposals.

Answered: 1 week ago

Question

Describe the components of a formal report.

Answered: 1 week ago

Question

Write formal and informal reports.

Answered: 1 week ago