Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need in java using the following: Round 1 Score: 00 player 1 , it is your turn. You rolled a 6. You have 6 points.

need in java using the following: image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Round 1 Score: 00 player 1 , it is your turn. You rolled a 6. You have 6 points. Keep going? (y) n Score: 60 Player 2 , it is your turn. You rolled a 3 . You have 3 points. Keep going? (y) y You rolled a 5. You have 8 points. Keep going? (y) n Round 2 Score: 68 Player 1 , it is your turn. You rolled a 5. You have 5 points. Keep going? (y) y You rolled a 6 . You have 11 points. Keep going? (y) n Score: 178 Round 3 Score: 178 player 1, it is your turn. You rolled a 5. You have 5 points. Keep going? (y) n Score: 228 player 2, it is your turn. You rolled a 6 . You have 6 points. Keep going? ( y) y You rolled a 6 . You have 12 points. Keep going? (y) y You rolled a 1. You will write a program in a class named DiceGame. To complete this program, you wul need to use a Scanner (or TextI0) for user input, the Math.random () method to select a random number, and if-else statements (as you did in GuessNumber.java). In addition, you will need to use a for-loop (or while loop) to repeat a block a specified number of times, and a while loop for the rolling of the die. - The game will have two players. In my program, I identified them as Player 1 and Player 2. (You may use different names, as long as we can tell whose turn it is.) - The game will last three rounds, and each player gets one turn per round. - When a player's turn begins, print the current score and identify whose turn it is: - A player's turn contimues until a 1 is rolled or until the player decides to stop and keep the points accumulated during their turn. - Select a random integer between 1 and 6 for the current die roll. - Report the value rolled. -If the player rolled a 1 , the turn is over with no points scored. Play: A new round begins. Player 1 rolls a single six-sided die. If they get a 1 , their turn is over. Otherwise, their roll is added to the number of points they've accumulated in the current round. After each roll, Player 1 can either stop and keep the points they've accumulated, or roll again to try and accumulate more points. If they ever roll a 1 , their turn ends, they lose all the points they've accumulated this round, and Player 2 gets to start rolling the die

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago