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
Use the following flowchart to implement a simple application that will help students decide whether computer science is a good
marissa [1.9K]

Answer:

1.yes

2.yes

3.no

4.yes

5.yes

6.yes

7.yes

8.yes

9.yes

10.yes

Explanation:

7 0
2 years ago
Which of the following is the largest disadvantage of wind power?
nydimaria [60]
The answer is     C.wind machines only generate electricity when wind is blowing
3 0
3 years ago
Read 2 more answers
Recall that the name of a transport-layer packet is segment and that the name of a link-layer packet is frame. What is the name
AlladinOne [14]

Answer:

A network-layer packet is a data gram. A router forwards a packet based on the packet's IP (layer 3) address. A link-layer switch forwards a packet based on the packet's MAC (layer 2) address.

Explanation:

When the end system receives the unstructured bit stream from the physical wire, each layer removes the header information applicable to it until the application receives the data.

1. An application, such as an email program, creates data that will be sent by an end user, such as an email message. The Application layer places a header (encapsulation) field that contains information such as screen size and fonts, and passes the data to the Presentation layer.

2. The Presentation layer places layer 6 header information. For example, the text in the message might be converted to ASCII. The Presentation layer will then pass the new data to the Session layer (layer 5).

3. The Session layer follows the same process by adding layer 5 header information, such as information that the Session layer will manage the data flow, and passes this data to the Transport layer (layer 4).

4. The Transport layer places layer 4 information, such as an acknowledgement that the segment was received in the header, and passes it to the Network layer (layer 3).

5. The Network layer places layer 3 header information, such as the source and destination address so the Network layer can determine the best delivery path for the packets, and passes this data to the Data Link layer (layer 2).

6. The Data Link layer places layer 2 header and trailer information, such as a Frame Check Sequence (FCS) to ensure that the information is not corrupt, and passes this new data to the Physical layer (layer 1) for transmission across the media.

7. The bit stream is then transmitted as ones and zeros on the Physical layer. It is at this point that the Physical layer ensures bit synchronisation. Bit synchronisation will ensure the end user data is assembled in the correct order it was sent.

8. Steps 1 through 7 occur in reverse order on the destination device. Device B collects the raw bits from the physical wire and passes them up the

Data Link layer. The Data Link layer removes the headers and trailers and passes the remaining information to the Network layer and so forth until data is received by the Application layer. Eventually, Device B will receive an email notification displaying a message to indicate that a new email message has been received.

5 0
3 years ago
Before guis became popular, the _______________ interface was the most commonly used.
sineoko [7]
<span>Before GUIs became popular, the command line interface (CLI) was the most commonly used.
</span>GUI stands for Graphical User Interface . Like its name says it is a graphical interface <span>that allows interaction with users through graphical icons and visual indicators , rather than through text-based interface.</span><span>
Command line interace (CLI) is text-based interface in which </span>the user <span>issues commands to the program in the form of successive lines of text.</span>
6 0
3 years ago
What is another term used for data dictionary?
Montano1993 [528]
About a database. A data dictionary defines the structure of the database itself (not that of the data held in the database) and is used in control and maintenance of large databases. Among other items of information, it records (1) what data is stored, (2) name, description, and characteristics of each data element, (3) types of relationships between data elements, (4) access rights and frequency of access. Also called system dictionary when used in the context of a system design

<span>Read more: http://www.businessdictionary.com/definition/data-dictionary.html</span>
4 0
3 years ago
Other questions:
  • What is ment by creative middle way solution
    6·1 answer
  • Two students are discussing the flow of electricity. Student A says that voltage is a measure of the amount of electron flow in
    8·1 answer
  • Brad Smith works for GHI Firm. GHI firm is a registered Broker-Dealer in State A, B and C and a registered IA in State A. Brad i
    10·1 answer
  • You decide to begin your presentation by providing your audience an overview of networking, with an emphasis on security and why
    11·1 answer
  • Design two subclasses of Employee…SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An ho
    12·1 answer
  • John works in the Sales and Marketing group. Why does his group need to interact with operations management to plan the launch o
    12·1 answer
  • Which of the following has the greatest impact on telecommunications design?
    12·2 answers
  • if anyone is on a Chromebook, do you ever mean to press backspace, then you accidentally press the power button and think "OH CR
    11·2 answers
  • Explain briefly how learning how to follow can make a person a good leader
    5·1 answer
  • Operating systems move code and data, as necessary, to a portion of the disk that is used as if it were memory, not just disk st
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!