Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering 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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92774491
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Refer to the reading e-business strategy how to benefit

Refer to the reading, "E-Business Strategy: How to Benefit From a Hype" and review its alignment between such models as SWOT and Five Forces and the e-business that it uses as a model. In your posting, address the follow ...

Across the nine cities in multilevel multivariate analysis

Across the nine cities, in multilevel, multivariate analysis, controlling for income inequality (GINI coefficient), percent living in poverty and percent Non-Hispanic Black population, the ZIP code level overall HIV diag ...

Question 1-what is cost and benefit analysis explain the

Question: 1- What is cost and benefit analysis? Explain the two different types of costs and two different types of benefits. 2- Discuss root-cause analysis as a BPA activity. What are the strengths and limitations of th ...

The police lieutenant in charge of the traffic division

The police lieutenant in charge of the traffic division reviews the number of traffic citations issued by each of the police officers in his division. He finds that the mean number of citations written by each officer is ...

What will a firewall not protect from why implement a

What will a firewall not protect from? Why implement a firewall?

How to response to those 3 following questionsrational

How to response to those 3 following questions Rational Agent ( Artificiall intellegence) 1. There can be more than one agent program that implements a given agent function. (If you agree, provide an example; otherwise a ...

Discuss honeypots are they legal should they be legal what

Discuss honeypots. Are they legal? Should they be legal? What are some of the potential problems for those implementing a honeypot?

Shell scripting -- linuxpart-1 write a script that asks the

Shell Scripting -- Linux Part-1 Write a script that asks the user to enter his name. Read the name. Then asks the user to enter the phone number. Then read the phone number. Append the name and phone number (separated by ...

When using todays digital cameras file sizes are often

When using today's digital cameras file sizes are often saved in a format that is well over 1 Megabyte. This may be great for high definition photo reproductions but is a disaster for uploading to the web. Images on your ...

Systems analysis projectpersonal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

  • 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