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
Alex17521 [72]
3 years ago
10

Write a user input program that simulates a game of a rolling pair of dice. You can create/simulate rolling one die by choosing

one of the integers values of 1, 2, 3, 4, 5, or 6 at randomly. The number that the user chooses will represents the number on the dice after it is rolled. As a hint use Math.random Which will perform the computation to select a random integer between 1 and 6. Assign the value to a variable to represent one of the dice that are being rolled. Perform this operation twice then you will add the results in order to obtain the total roll. Your program should output the number showing on each dice as well as the total roll. For example:
Computers and Technology
1 answer:
balu736 [363]3 years ago
6 0

Answer:

Follows are the program to this question:

public class Main//defining a class  

{

  public static void main(String[] bax)//main method

  {

       int d1,d2,r;   //defining integer variables  

       d1 = (int)(Math.random()*6) + 1;//defining d1 variables that use random method to store a random value  

       d2 = (int)(Math.random()*6) + 1;//defining d2 variables that use random method to store a random value

       r= d1 + d2;//defining r variable that adds d1 and d2 values

       System.out.println("On the first time die will gives: " + d1);//print values with the message

       System.out.println("On the second time die will gives: " + d2);//print values with the message

       System.out.println("The total roll value is: " + r);//print values with the message

   }  

}  

Output:

On the first time die will gives: 6

On the second time die will gives: 1

The total roll value is: 7

Explanation:

In this code three integer variable "d1,d2, and r" is declared, in which the "d1 and d2" variable is used, that uses the random method to hold a random value from 1 to 6 in its variable.

In the next step "r" variable is declared that calculates the addition of the "d1 and d2", and at the last, it uses the print method to print value with the message.  

You might be interested in
Please help
nata0808 [166]
NOT is the boolean operator which omits information from the search parameters.
5 0
4 years ago
Read 2 more answers
The most important task in developing a new computer system/app is to: a) choose the most current technologies such as operating
Ede4ka [16]

Answer:

c) establish a good relationship with the user and develop detailed and complete user requirements.

Explanation:

A new computer system/app is a computer software designed to perform a group of coordinated functions, tasks, or activities for the benefit of the user. It must be designed to help people carry out an activity.

6 0
3 years ago
What are the parts of word?
jolli1 [7]

Answer:

Explanation:

ASIA includes 50 countries, and it is the most populated continent, the 60% of the total population of the Earth live here.

AFRICA comprises 54 countries. It is the hottest continent and home of the world's largest desert, the Sahara, occupying the 25% of the total area of Africa.

NORTH AMERICA includes 23 countries led by the USA as the largest economy in the world.

SOUTH AMERICA comprises 12 countries. Here is located the largest forest, the Amazon rainforest, which covers 30% of the South America total area.

ANTARCTICA is the coldest continent in the world, completely covered with ice. There are no permanent inhabitants, except of scientists maintaining research stations in Antarctica.

EUROPE comprises 51 countries. It is the most developed economically continent with the European Union as the biggest economic and political union in the world.

AUSTRALIA includes 14 countries. It is the least populated continent after Antarctica, only 0.2% of the total Earth population live here.

7 0
3 years ago
Is MS DOS a network operating system?​
chubhunter [2.5K]

Answer:

Operating systems now use networks to make peer-to-peer connections and also connections to servers for access to file systems and print servers. The three most widely used operating systems are MS-DOS, Microsoft Windows and UNIX.

Explanation:

7 0
3 years ago
Cathy designed a website for a cereal brand. When users view the website, their eyes first fall on the brand name, then they vie
katrin2010 [14]

Hey there!

I would say the answer to this question is <u>Movement</u>.

If you look at the principles of design the definition of Movement is <u>Movement is the path the viewer's eye takes through the work of art, often to focal areas.</u>

In Cathy's design, it states that when viewers view her website their eyes first fall on the brand name, and then they view the bright images on the page.

Based on the information given you can conclude that the design principle that Cathy used was <u>Movement</u>.

I hope this helps,

Have a great day!

<u></u>

4 0
3 years ago
Other questions:
  • Quote one of morrie's aphorisms and explain what you think it means (page 18).
    14·1 answer
  • In a doubly linked list, every nodecontains the address of the next node and the previousnode except for the ____ node.
    8·1 answer
  • How does a hard drive work
    14·1 answer
  • How do I only give 5 points and not 10?
    7·1 answer
  • What does the cpu do (in terms of register contents and stack) when it executes a jsr instruction?
    12·1 answer
  • True or False <br><br> Rootkits are only made by black-hat hackers.
    11·1 answer
  • Case-Based Critical Thinking Questions​Case 1: Tony’s Pizza &amp; Pasta​Tony’s Pizza &amp; Pasta restaurant uses an application
    9·1 answer
  • What is an effective way to record change management? (5 points)
    9·1 answer
  • How do you program a computer
    7·1 answer
  • What is the output of the following code<br> X = 06<br> y = 0<br> print (x ** y)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!