Question: I request the expert don't copy and paste the answer from other question and please use basic java with scanner class. Program it for two

 I request the expert don't copy and paste the answer fromother question and please use basic java with scanner class. Program itfor two players only. See sample output and program. The Coin classshould have the following methods: A no-arg constructor that randomly determines theside of the coin that is facing up ('heads' or 'tails') andinitializes the sideUp field accordingly. A void method named toss that simulates

I request the expert don't copy and paste the answer from other question and please use basic java with scanner class. Program it for two players only. See sample output and program.

The Coin class should have the following methods: A no-arg constructor that randomly determines the side of the coin that is facing up ('heads' or 'tails') and initializes the sideUp field accordingly. A void method named toss that simulates the tossing of the coin. When the toss method is called, it randomly determines the side of the coin that is facing up ('heads' or 'tails') and sets the sideUp field accordingly. A method named getSideUp that returns the value of the sideUp field. . Secondly, you will implement the 'Heads or Tails' game. This game is meant for two or more players. In this game, the players take turns flipping a coin. Before the coin is flipped, players should guess if the coin will land face up or face down. If a player guesses correctly, then the player is awarded one point. If a player guesses incorrectly, then the player will lose a point. The first player to score three points is the winner. Write a program named HeadsOrTailsGame.java that simulates the game being played by two players. Use the Coin class that your previously wrote to simulate the coin. Also write the player class to simulate the players. Next a simple run is shown of this application: Enter the first player's name: John Enter the second player's name: Mary Round 1 Start! John guessed heads. Mary guessed tails. The coin was tossed. The coin landed on tails. John guessed incorrectly. John lost a point. Mary guessed correctly. Mary was awarded a point. John has -1 point (s). Mary has 1 point (s). Round 2 Start! John guessed heads. Mary guessed heads. The coin was tossed. The coin landed on heads. John guessed correctly. John was awarded a point. Mary guessed correctly. Mary was awarded a point. John has 0 point (s). Mary has 2 point (s). Round 3 Start! John guessed tails. Mary guessed tails. The coin was tossed. The coin landed on heads. John guessed incorrectly. John lost a point. Mary guessed incorrectly. Mary lost a point. John has -1 point (s). Mary has 1 point (s). Round 4 Start! - John guessed heads. Mary guessed tails. The coin was tossed. The coin landed on heads. John guessed correctly. John was awarded a point. Mary guessed incorrectly. Mary lost a point. John has 0 point (s). Mary has 0 point (s). Round 5 Start! - - John guessed tails. Mary guessed tails. The coin was tossed. The coin landed on tails. John guessed correctly. John was awarded a point. Mary guessed correctly. Mary was awarded a point. John has 1 point (s). Mary has 1 point (s). Round 6 Start! John guessed heads. Mary guessed tails. The coin was tossed. The coin landed on heads. John guessed correctly. John was awarded a point. Mary guessed incorrectly. Mary lost a point. John has 2 point (s). Mary has 0 point (s). Round 7 Start! - - - - John guessed tails. Mary guessed heads. The coin was tossed. The coin landed on tails. John guessed correctly. John was awarded a point. Mary guessed incorrectly. Mary lost a point. John has 3 point (s). Mary has -1 point (s). Game Over John is the winner

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!