Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

The aim of Gue55ing Game is for a person and the computer to compete against other to correctly guess a hidden number. 

A game consists of four rounds. For each round a number between 1 and 100 (inclusive) is randomly generated and the players (person and computer) take turns to guess the number. The round ends when the correct guess is given or each player has had three guesses.

If a player guesses the number correctly then they are awarded points according to how many attempts were taken to guess the number. If the round ends without either player guessing correctly then the points are awarded to each player according to how close they were to the hidden number.

At the end of the four rounds the player with the highest cumulative score wins the game.

Your program should consist of at least three classes: Player, Game and RandomNumber.

Player class

The Player class will specify the attributes and behaviours of a player. An object of the Player class will have the following fields (at least):

Name - the name of the player.

Score - the cumulative game score

Guesses - the last number guessed for the current round

The data type of each field must be chosen carefully and you must be able to justify the choice of the data type of the fields. You may want to include comments in the class to state the assumption made. The class must also have a default constructor and a non-default constructor that accepts a value for the name of the player.

The Player class should also have appropriate accessor and mutator methods for its fields. You should not allow an object of class Player to be set to an invalid state. There should be no input from the terminal or output to the screen. A Player object should also be able to return its state in the form of a String.

Game class 

The Game class will be in the same BlueJ project that contains your Player class. The Game class will manage the playing of a game. It will have the following fields (at least): 

Player1 (an object of type Player) 

Player2 (an object of type Player) 

Note that one of these players will be the computer. 

The Game class will have methods to manage the playing of the game. These should include (at least) the following behaviours: 

    • Display a welcome message on the screen.
  • • Request the player to enter their name. 
  • • Request the player to enter a number. 
  • • Compare the number entered by a player with the hidden number. 
  • • Display the result of the attempt at guessing the number. 
  • • Display the result for the end of a round (including the value of the hidden number). 
  • • Display the game result. 

RandomNumber class 

An object of the RandomNumber class will generate a random number from 1 to a maximum value specified.

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M92772970
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Management

You are saving up to buy a toyota tundra which costs 35000

You are saving up to buy a Toyota Tundra, which costs $35000 now. You don't think the price of the Toyota will change over the next two years. You don't want to borrow to pay any of this cost. You now have $10000 toward ...

Now 5yuan 075 usd before 1usd 5 yuanwhich currency has

Now 5yuan = 0.75 USD, before: 1USD = 5 yuan Which currency has appreciated? why? and Identify two economic factors that can explain your answer to the above question ( what is economic factor? I know that USD is appricia ...

1 is corporate culture an important element in an

1. Is corporate culture an important element in an organization and its strategic direction? 2. How can organizational culture be created, influenced, and changed?

What is an example of corporation that uses information

What is an example of corporation that uses Information technologies to improve their decision making other than Verizon's web-based digital dash baords.

What are some ways in which the transportation security

What are some ways in which the Transportation Security Administration is attempting to improve the security of the U.S. transportation system? Discuss the Customs Trade Partnership Against Terrorism (C-TPAT).

In recent years some researchers have proposed that

In recent years, some researchers have proposed that narcissism levels are on the rise as evidenced by an increased sense of entitlement and unrealistic expectations in younger generation millennials; and by an overall r ...

What types of challenges do human resources managers face

What types of challenges do human resources managers face in a modern business environment?

Can you recall a time when you used intuition to make a

"Can you recall a time when you used intuition to make a decision? Would this have had a better outcome if you used one of the decision-making models to assist in this situation?" Describe the situation, your intuitive m ...

Which are five process functional areas of project

Which are five process functional areas of project management framework. Describe main objectives of each functional area and project risk factors face by information technology.

Is the companys personality-harvesting method ethical why

Is the company's personality-"harvesting" method ethical? Why, or why not? Should people who attempt to answer the questionnaire be advised, ahead of time, that the data collected from those questionnaires will be used t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As