The Game:
Build a simple game that will allow a player to attempt to guess a randomly generated number from 1 to 10 inclusive.
The player can continue guessing until they get it right.

What your game should do:
1. Your game should remember each choice that the player enters.
2. Each time the player gets the guess wrong tell the player to try again.
3. If the player guesses correctly tell them they were right and also what the number was that they entered.
a. Your game should then print out all the values that the player entered for that game, in the order in which they were entered.
4. The player can then play the game again, but only two more times.

Your program should follow an object-oriented format:
• Your should have two classes in this program:
o The main class
o The class that controls the game.

• Name the class that controls the game - ‘’.
o This class should include a random number generator, an array/ArrayList that remembers the player’s choices, input from the console (use the Scanner class), and code that starts the game.

• You should modularize your code in the ‘GamePlay’ class; i.e. break it down into methods that do different tasks.
o Your methods and instance variables should be named appropriately and also be defined by the correct modifiers.
o Use print statements via the console to introduce the player to the game and guide him/her through it and show the final results.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

//Bus is another Sub-Class
public class Bus extends Machine {

    // attributes and behaviors unique by subclass
    private int myGearCount;

    public Bus() {

    public Bus(int gearCount) {
       this.myGearCount = gearCount;

    public Bus(String brand, String color, int yearOfMake, int gearCount) {
       super(brand, color, yearOfMake);
       this.myGearCount = gearCount;
    // Methods go here

    public String toString() {
       return "The brand is: " + myBrand + "\nThe color is: " + myColor + "\nYear of Make is: " + yearOfMake + "\nThere is: " + myGearCount + " gears";

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats