Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the RollDie.java: import java.util.Random; import java.util.Scanner; /* * HEADER HERE !! */ public class RollDie { public static void main(String[] args) { Scanner scnr =

image text in transcribed

the RollDie.java:

import java.util.Random; import java.util.Scanner; /* * HEADER HERE !! */ public class RollDie { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); // Step 1: Declare and initialize array and // initialize random number generator int[] rollValueCounts = new int[7]; Random randGen = new Random(); // Step 2: Determine the number of rolls System.out.print("How many times do you want to roll the die?"); System.out.print(" [Max value is 100] "); int numRolls = scnr.nextInt(); // TODO: Check that user provided value is valid // (i.e., in the range 0-100) and if not reprompt System.out.println("Let's get rolling..."); // Step 3: Generate numRolls random values between 1-6 for(int i = 0; i   objective: create methods that receive arrays as arguments. Problem Statement: Roll a 6-side die a user specified number of times and keep track of the number of times each value appears. Simulate rolling the die by generating a random number in the range of 1 to 6. After rolling the die the needed number of rolls, display a histogram of the distribution of roll values See the sample output below How many times o you want to ro the die Max value s 1 00 TRY AGAIN! Hou many times do you want to roll the die? [Max value is 100] 15 Let's get rolling The number of 1's 4 The number of 2's The number of 3's The number of 4 The number of 5's: 4 The number of 6's: 2 To begin, create a new project called Lab9-RollDie'. Download and add the Roll Diejava starter code provided on Blackboard

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago