Question: Implement the following: Create a Player class and a Main class. Player class will have a username (string), score (int) and email (string) as fields.

 Implement the following: Create a Player class and a Main class.

Implement the following: Create a Player class and a Main class. Player class will have a username (string), score (int) and email (string) as fields. The class also provides setters and getters for each variable and provides a constructor that initializes the fields with setters. In main, create a new player and receive the input from the user. Make sure to account for the exceptions (such as input mismatch) here. Use a random number generator to generate numbers from 1 to 20. Let the user guess the answer, if correct, add 100 to the user's score. Otherwise, randomly pick another number and repeat this until the user quits (by typing -999). Once the user quits, print the username and score information. 15:58

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!