Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an application that rolls a pair of six-sided dice. Console Dice Roller Roll the dice? (y/n): y Die 1: 3 Die 2: 1
Create an application that rolls a pair of six-sided dice. Console Dice Roller Roll the dice? (y/n): y Die 1: 3 Die 2: 1 Total: 4 Roll again? (y/n): y Die 1: 1 Die 2: 1 Total: 2 Snake eyes! Roll again? (y/n): y Specifications You can use the random method of the Math class to generate a random number for a die like this: (int) (Math.random() * 6) + 1; Die 1: 6 Die 2: 6 Total: 12 Boxcars! Roll again? (y/n): n The application should display special messages for two ones (snake eyes) and two sixes (box cars). The application should use static methods to organize its code. The application should continue only if the user enters "y" or "Y" at the "Roll again?" prompt. Static methods private static String getUserChoice(Scanner sc, String prompt) { } private static int rollDie() { } private static void printDice(int die 1, int die2) { } private static void printSpecialMessage(int total) { }
Step by Step Solution
★★★★★
3.37 Rating (156 Votes )
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