Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This game is meant for two or more players. In the game, each player starts out with 30 points, as each player takes a turn

This game is meant for two or more players. In the game, each player starts out with 30 points, as each player takes a turn rolling the dice; the amount generated by the dice is subtracted from the player’s points. Either the first player with exactly one point, or the player with the lowest number of points after 10 rounds wins, whichever comes first. If a player’s remaining points minus the amount generated by the dice results in a value less than 1, the value of the dice is added to the player’s points.

Write a program that simulates the game being played by two players. Use the Die class that was presented in Chapter 6 (a copy is attached) to simulate the dice. Write a Player class to simulate the players. Your program should notify each player of their turn, activate their roll when the player enters a key and display the roll of the dice and the player’s current net points. At the end of the game, display a message to congratulate the winner and show each player’s points.

Your program should allow the user to control the flow of the game by allowing them to enter a key to activate the roll.

Create and save the program that demonstrates the class. Two programs are needed (Player class and Demo class)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Program Screenshots Sample Output Code to Copy Die java import javautilRandom The Die class simulates a sixsided die public class Die private i... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles of Information Security

Authors: Michael E. Whitman, Herbert J. Mattord

4th Edition

978-1111138219, 1111138214, 978-1285448367

More Books

Students also viewed these Accounting questions

Question

3.4 Evaluate the DSM system, listing its strengths and weaknesses.

Answered: 1 week ago