Question: lottery JAVA program to simulate the lottery . In this game the player will pick four numbers (between 1 and 40 inclusive) and the computer

lottery JAVA program to simulate the lottery. In this game the player will pick four numbers (between 1 and 40 inclusive) and the computer will generate four random numbers (between 1 and 40 inclusive).

The specifications are as follows:

You must have a user defined classes within the code. Code done in only one main method will not be accepted!

The data structure you MUST use for the four player selected numbers is:

int[] player=new int[4] ;

The data structure you MUST use for the four computer generated numbers is:

int[] computer=new int[4];

Specifications of the project:

Create one new user defined class to contain all of the methods and all of the data

Create a method within the class to prompt the player to select 4 numbers between 1 and 40 inclusive

Create a method within the class to have the computer generate 4 random numbers between 1 and 40 inclusive

Create a method within the class to count how many of the players numbers matched the computers generated numbers

Create a method within the class to print the players numbers, the computer s numbers and the number of matches

Your code must run until the player wants to stop. You will ask the player if they want to play the lottery game again and then start another game (ask for new numbers etc) You must make sure the player can enter capital or lower case letters to allow the lottery game to be played again. For example, if you are asking the player to enter yes, your program must be user friendly and accept any combination of capital of lower case letters such as yes, YES, Yes, yES, yeS (hint: you could use a Java string function to change the input to all upper or lower case)

Additional Requirements:

All braces are to be on lines by themselves

The java base class and the main method in the java program is to be first in the code and your new class is to be AFTER the java base class (after the System.exit(0));

All data must be defined at the beginning of each method

You will have to investigate and implement code to:

Generate a random number between 1 and 40

Change upper case to lower case etc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!