1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetoff [14.1K]
4 years ago
11

Create a new Die object. (Refer to Die.html for documentation.)Create a loop that will iterate at least 100 times. In the loop b

ody:Roll the die. (Don't create a new object, just roll it again.)Based on the result of the roll, increment the corresponding cell of your array.
Computers and Technology
1 answer:
hjlf4 years ago
8 0

Answer:

Java code is given below

Explanation:

import java.util.Random;

class Die{

private int sides;

public Die(){

sides = 6;

}

public Die(int s){

sides = s;

}

public int Roll(){

Random r = new Random();

return r.nextInt(6)+1;

}

}

class DieRoll{

public static void main(String[] args) {

Die die = new Die();

int arr[] = new int[6];

for(int i=0; i<6; i++)

arr[i] = 0;

for(int i=0; i<100; i++){

int r = die.Roll();

arr[r-1]++;

}

for(int i=0; i<6; i++)

System.out.println((i+1)+" was rolled "+arr[i]+" times.");

}

}

You might be interested in
What were the names of Henry VIII's six wives?
timurjin [86]

Answer:

Jane Seymour,Anne Boleyn,Katherine of Aragon,Anne of Cleves,Katherine Howard,Katherine Parr

Explanation:

7 0
2 years ago
Read 2 more answers
Explain the history of computing of mechanical era
OLga [1]

Answer:The Mechanical Era

Created a machine that could add and subtract numbers. Dials were used to enter the numbers. ... Designed a machine called the Analytical Engine. The design had all the basic components of a modern day computer. In addition, it was designed to be programmable using punched cards.

Explanation:Hope this helped

4 0
3 years ago
Read 2 more answers
Does the child in the crosswalk have the right of way? Explain why or why not.
qwelly [4]
A pedestrian always has the right of way when crossing a street in a crosswalk
3 0
3 years ago
Who do you like more?
Deffense [45]

Answer:

i would do both plz dont hate meh for it...

Explanation:

they both are cool but one appears in more games and thats Freddy but golden freddy and Freddy appear in fnaf 2 so thats my opinion on them.

4 0
3 years ago
Read 2 more answers
Pls true or false answer correctly plsss needs help
Veseljchak [2.6K]
Question 9 is true 10 is false :)
6 0
3 years ago
Other questions:
  • A user reports that he can't connect to a specific website. you go to the user's computer and reproduce the problem. what should
    11·1 answer
  • Help?!<br> Does anyone know how to use Adobe SoundBooth?
    14·2 answers
  • Television has greatly influenced how politicians are perceived via the sound bite and ________ campaigning.
    11·1 answer
  • ________ symbol is used in the "Advanced" section of the time range picker to round down to nearest unit of specified time.
    8·1 answer
  • What does limited access to a document mean?
    7·2 answers
  • Why would a person who handles electronic components wear a grounded wrist strap
    13·1 answer
  • How is marketing related to the other functions of a business
    14·1 answer
  • Which is the correct attribute syntax
    9·1 answer
  • What is a closed system?​
    7·1 answer
  • To input lenth in meter and convert in to centimeter​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!