Please help me solve this with java .... just the HangMan          HangMan instruction class : • 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. 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please help me solve this with java .... just the HangMan 

 

 

 

 

HangMan instruction class :

• 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.

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.

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
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY