Question: In JAVA: Create a Player class and a Main class. Player class will have a username (string), score (int) and email (string) as fields. The
In JAVA:
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. Make sure you implement a Singleton as Player class so that we can use only a single player object in the game.
In main, use this player. 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
