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]
3 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:
hjlf3 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
write a simple assembly code using 8088 microprocessor instruction set to add two numbers ? please help me if you know :(​
Kay [80]

Answer:

sexxxxx chaaaaat insta id abhilash0351

3 0
3 years ago
Preciso de ajudar para resolver esse exercício, é para amanhã cedo!!<br><br> Em Dev C++
LenKa [72]
Bbbbbbbbbbbbbbbbbbbbbb
3 0
3 years ago
Read 2 more answers
You will use the Word application to design, develop, and create a business letter to potential clients of your new business. Th
LUCKY_DIMON [66]

Answer:

Mail Merge Data Source

Explanation:

7 0
3 years ago
Is a defense of a political position an argument
shutvik [7]

Answer:

yes

Explanation:

yyyyyyyyyyeeeeeeeeesssssss

8 0
3 years ago
Mary needs to choose the menu in order to place the text in a desired fashion around the image.
n200080 [17]
Can you be more specific?

7 0
3 years ago
Read 2 more answers
Other questions:
  • Software license infringement is also often called software __________.
    11·2 answers
  • A ____ is a program that is installed without the permission or knowledge of the computer user, that is designed to alter the wa
    11·1 answer
  • What does cro stand for?
    7·2 answers
  • This program has some errors in it that are needed to be checked import java.io.*;
    13·1 answer
  • What is the program that searches through data bases?
    10·1 answer
  • In UNIX, how do I set the permissions on MyProgram.py to: rwx---r-x?
    7·1 answer
  • . public members are accessible from ________________ where the object is visible
    9·1 answer
  • The part of a rocket engine that allows the combustion gases and flames to leave the rocket engine is the
    14·1 answer
  • Users at UC need to be able to quickly create a Resource record from the Project record's Chatter feed How should the App Builde
    10·1 answer
  • Where do players resurrect if they have been destroyed in a game?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!