Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me write this program in Java. Program (8 pts): Write a program that will simulate a dice-roll game between two players. Each player
Please help me write this program in Java.
Program (8 pts): Write a program that will simulate a dice-roll game between two players. Each player will throw two standard six-sided dice, and whoever has the highest total will win the game. Requirements: You will need to create Scanner and Random objects. (2 pts) Include a welcome message, appropriate prompts/labels using the players' names during the game, and a goodbye message when the user quits (see Sample Output below for an example run of the program). (2 pts) You must use a do-while loop to implement your game play. The body of your loop should execute at least once, i.e. at least one game is played before the user can quit. Hint: The body of . your loop should begin with the "Here we go!" message (see Sample Output). - (4 pts) Tips: Take a moment to sketch out a plan (algorithm) before you start typing code. Create your Scanner and Random objects, declare all your variables, and collect the players' names before your do-while loop begins. .If the game results in a tie, print an appropriate message saying so. You can use+'to concatenate strings and ints when you display output. Ex: int age31; String name = "Turing"; System.out.println ("Prof. " + name"is"+age + " years old.") Output: Prof. Turing is 31 years old. Test your program piece by piece, as you are writing it. Sample Output: Welcome to Dice Match! What is Player l's first name? Larry What is Player 2's first name? Moe Here we go! Larry 4 5 Moe 2 5 And the winner is... Larry with a total of g Enter l to play again, or 0 to quit: 1 Here we go! Larry 5 3 4 4 And the winner is... It's a tie! Enter 1 to play again, or 0 to quit: 1 Here we go! Larry 5 5 Moe 3 5 And the winner is... Larry with a total of 10 Enter 1 to play again, or 0 to quit: 0 Thanks for playing, goodbye! BUILD SUCCESSFUL (total time: 32 seconds)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started