Question: (In Java) Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum.
(In Java) Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user:
Desired dice sum: 9
4 and 3 = 7
3 and 5 = 8
5 and 6 = 11
5 and 6 = 11
1 and 5 = 6
6 and 3 = 9
Finish the following code file:
import java.util.*;
public class TestDiceRoll {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Desired dice sum: ");
int sum = console.nextInt();
// your code here
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
