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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!