Question
Consider and understand the scenario that follows. Debug the program in order for it to run as stated in its specification The program in the
Consider and understand the scenario that follows. Debug the program in order for it to run as stated in its specification
The program in the next page, when ran, will let the user roll a pair of dice n-times (i.e. generate a number between 1 and 6), where n is a positive integer entered by a user. The program then outputs the pair of numbers rolled by the dice, as well as the sum of the numbers rolled by each pair of dice. The pairs of numbers are stored in a 2-dimensional array, and the sum of each pair are stored in a single-dimensional array.
import java.util.Scanner; import java.util. Random; public class Finalexam{ public static void main(String() args) { Scanner input - Scanner(System.in); System.out.print("Enter the amount of times a pair of dice will roll: "); int times - keyboard.nextInt(); int[] dicepairs - rollDicepairs(times); System.out.println("The rolled pairs of numbers are:"); printDicePairs(dicePairs); System.out.println("The sum of each pairs of numbers are: "); int(1) dicepairsSums - addDicepairs(dicePairs); printDicePairsSums(dicePairsSums); ) public static double(10) rollDicepairs(int times) { int[][] dice new int[times ][2]; Random die - new Random(); for(int x-0; xStep 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