Please help me solve it today I posted it yesterday and got rejected I don't know why:( Please help me solve this with Java Game class instructions:• Game class has three attributes: points (which represent the number of points awarded when  winning the game), status (false if the game has not been played and true if the game has been  played), and description (which is a text description of the game). Note that description attribute  is a read-only variable.  • In the constructor, initialize points to zero, status to false, and description to the given parameter. • isPlayed method returns true if the game has been played, and false otherwise. • getPoints is a getter method for points attribute. • play method is an abstract method. • Override toString method to return the game description. • Override equals method so that two games are the same if their descriptions are the same.  :instructions class )  HangMan • HangMan is a game in which a player tries to guess a word based on a given hint. For example, if  the given hint is “movie”, then the player must guess a movie name. If the given hint is a “country”,  then the player must guess a country name, and so on. • The game starts by showing a message on the screen that shows the hint and all letters in the word  but obscured as dashes (-). Then, the game will allow the player to guess 5 letters. If the player  gives a letter that actually exists in the word, then this letter will be revealed. Afterwards, the game  will ask the player to give the answer. If the given answer is correct, then the game will show a  message that the player has won 5 points. Otherwise, the game will show a message that the player  has lost. Below is one possible game scenario, in which the word is “iron man”, and the hint is  “movie”. Note that the text in green color is the input given by the player. (I will send it in a comment because of the space ) Note that if the player knows the answer before the 5 trials are used, then the player can insert  hashtag # to terminate the trials and give the answer directly. If the given answer is indeed correct,  then the player will be awarded more points. See the below scenario. HangMan class has four attributes: word (which the word that a player needs to guess), hint (which  is the given hint to the player), numOfTrials (which is the number of trials), and MAX_TRIALS  (a constant field that is set to 5). Note that word and hint attributes are read-only variables. • In the constructor, initialize each attribute to its proper parameter. Note that numOfTrials attribute  is initially set to 0. • Implement the play method as explained before while doing exception handling. More specifically,  during guessing letters, if the player inputs more than one character, then your Java program should  terminate and throw a RuntimeException. To calculate the awarded points for winners, use the  formula: points = 30 - 5 * numOfTrials Note that the maximum number of trials is equal to MAX_TRIALS. Also, note that play method  must set the game status to true to indicate that the game has been played.  Player class instructions: • Player class has two attributes: name (which is the name of the player), and games (which is an  array list that contains games that the player wants to play).  • In the constructor, initialize name to the given parameter, and games to an empty list. • getName method is a getter method for name attribute. • addGame method adds a game to the games list. • play method will run all unplayed games, while skipping games that have been played before. • getPoints method returns the total number of points awarded to the player from played games. • getNumberOfPlayedGames method returns the total number of played games. Note that unplayed  games should not be counted. Platform class instructions: • Platform class has one attribute: an array list of players. • In the constructor, initialize players list to empty list. • addPlayer method adds a player to the players list. • bestPlayerName method returns the name of the player with the highest points. In case there was  no players, then return “None”. Also, if all players have zero points, then also return “None”. If  you happen to have more than one player with the same best number of points, then it is okay to  return the name of any of the best players. General Notes: • You must follow the aggregation and inheritance relationships shown in the UML diagram.  • Do not add new attributes beyond the ones we specified in each class. • Do not add any public methods beyond the ones we specified in each class. However, creating  private methods is okay. • Create a test class with a main method and use to test it your classes however you deem fit. Name  your test class Main.java.  intentionally did not say anything about the main method   want to leave it to you to determine how to test the code

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please help me solve it today I posted it yesterday and got rejected I don't know why:(

Please help me solve this with Java

Game class instructions:• Game class has three attributes: points (which represent the number of points awarded when 
winning the game), status (false if the game has not been played and true if the game has been 
played), and description (which is a text description of the game). Note that description attribute 
is a read-only variable. 
• In the constructor, initialize points to zero, status to false, and description to the given parameter.
• isPlayed method returns true if the game has been played, and false otherwise.
• getPoints is a getter method for points attribute.
• play method is an abstract method.
• Override toString method to return the game description.
• Override equals method so that two games are the same if their descriptions are the same. 
:instructions class )  HangMan
• HangMan is a game in which a player tries to guess a word based on a given hint. For example, if 
the given hint is “movie”, then the player must guess a movie name. If the given hint is a “country”, 
then the player must guess a country name, and so on.
• The game starts by showing a message on the screen that shows the hint and all letters in the word 
but obscured as dashes (-). Then, the game will allow the player to guess 5 letters. If the player 
gives a letter that actually exists in the word, then this letter will be revealed. Afterwards, the game 
will ask the player to give the answer. If the given answer is correct, then the game will show a 
message that the player has won 5 points. Otherwise, the game will show a message that the player 
has lost. Below is one possible game scenario, in which the word is “iron man”, and the hint is 
“movie”. Note that the text in green color is the input given by the player.

(I will send it in a comment because of the space )

Note that if the player knows the answer before the 5 trials are used, then the player can insert 
hashtag # to terminate the trials and give the answer directly. If the given answer is indeed correct, 
then the player will be awarded more points. See the below scenario.

HangMan class has four attributes: word (which the word that a player needs to guess), hint (which 
is the given hint to the player), numOfTrials (which is the number of trials), and MAX_TRIALS 
(a constant field that is set to 5). Note that word and hint attributes are read-only variables.
• In the constructor, initialize each attribute to its proper parameter. Note that numOfTrials attribute 
is initially set to 0.
• Implement the play method as explained before while doing exception handling. More specifically, 
during guessing letters, if the player inputs more than one character, then your Java program should 
terminate and throw a RuntimeException. To calculate the awarded points for winners, use the 
formula: points = 30 - 5 * numOfTrials
Note that the maximum number of trials is equal to MAX_TRIALS. Also, note that play method 
must set the game status to true to indicate that the game has been played. 
Player class instructions:
• Player class has two attributes: name (which is the name of the player), and games (which is an 
array list that contains games that the player wants to play). 
• In the constructor, initialize name to the given parameter, and games to an empty list.
• getName method is a getter method for name attribute.
• addGame method adds a game to the games list.
• play method will run all unplayed games, while skipping games that have been played before.
• getPoints method returns the total number of points awarded to the player from played games.
• getNumberOfPlayedGames method returns the total number of played games. Note that unplayed 
games should not be counted.
Platform class instructions:
• Platform class has one attribute: an array list of players.
• In the constructor, initialize players list to empty list.
• addPlayer method adds a player to the players list.
• bestPlayerName method returns the name of the player with the highest points. In case there was 
no players, then return “None”. Also, if all players have zero points, then also return “None”. If 
you happen to have more than one player with the same best number of points, then it is okay to 
return the name of any of the best players.
General Notes:
• You must follow the aggregation and inheritance relationships shown in the UML diagram. 
• Do not add new attributes beyond the ones we specified in each class.
• Do not add any public methods beyond the ones we specified in each class. However, creating 
private methods is okay.
• Create a test class with a main method and use to test it your classes however you deem fit. Name 
your test class Main.java.  intentionally did not say anything about the main method 
 want to leave it to you to determine how to test the code

Write a Java program that implements the system shown in the following UML class diagram, which
represents a gaming platform:
Platform
- player: java.util.ArrayList<Player>
+ Platform()
+ addPlayer(player: Player): void
+ bestPlayerName(): String
Player
- name: String
- games: java.util.ArrayList<Game>
+ Player(name: String)
+ getName(): String
+ addGame(game: Game): void
+ play(): void
+ getPoints(): long
+ getNumberOfPlayedGames(): int
#points: long
#status: boolean
description: String
Game
+ Game(description: String)
+ isplayed(): boolean
+ getPoints(): long
+ play(): void
- word: String
- hint: String
- numOfTrials: int
- MAX TRIALS: int = 5
HangMan
+ HangMan(description: String, word: String, hint: String)
+ play(): void
Transcribed Image Text:Write a Java program that implements the system shown in the following UML class diagram, which represents a gaming platform: Platform - player: java.util.ArrayList<Player> + Platform() + addPlayer(player: Player): void + bestPlayerName(): String Player - name: String - games: java.util.ArrayList<Game> + Player(name: String) + getName(): String + addGame(game: Game): void + play(): void + getPoints(): long + getNumberOfPlayedGames(): int #points: long #status: boolean description: String Game + Game(description: String) + isplayed(): boolean + getPoints(): long + play(): void - word: String - hint: String - numOfTrials: int - MAX TRIALS: int = 5 HangMan + HangMan(description: String, word: String, hint: String) + play(): void
Here is another game scenario where the player has lost.
Hint: movie
You have 5 trials left
Enter your letter
d
You have 4 trials left
Enter your letter.
m
----M--
You have 3 trials left
Enter your letter.
n
---n m-n
You have 2 trials left
Enter your letter.
h
---n m-n
You have 1 trials left
Enter your letter.
f
---n m-n
=======
Enter your guess
rain man
You lost
The answer is iron man
Note that if the player knows the answer before the 5 trials are used, then the player can insert
hashtag # to terminate the trials and give the answer directly. If the given answer is indeed correct,
then the player will be awarded more points. See the below scenario.
Hint: movie
========
You have 5 trials left.
Enter your letter
n
---n --n
You have 4 trials left.
Enter your letter.
i
i--n --n
You have 3 trials left
Enter your letter.
#
===========
============
Enter your guess
iron man
You won with 20 points
3
Transcribed Image Text:Here is another game scenario where the player has lost. Hint: movie You have 5 trials left Enter your letter d You have 4 trials left Enter your letter. m ----M-- You have 3 trials left Enter your letter. n ---n m-n You have 2 trials left Enter your letter. h ---n m-n You have 1 trials left Enter your letter. f ---n m-n ======= Enter your guess rain man You lost The answer is iron man Note that if the player knows the answer before the 5 trials are used, then the player can insert hashtag # to terminate the trials and give the answer directly. If the given answer is indeed correct, then the player will be awarded more points. See the below scenario. Hint: movie ======== You have 5 trials left. Enter your letter n ---n --n You have 4 trials left. Enter your letter. i i--n --n You have 3 trials left Enter your letter. # =========== ============ Enter your guess iron man You won with 20 points 3
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education