Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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; x )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago