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
You are trying to access WiFi network at a coffee shop. What protocol will this type of wireless networking most likely use?
monitta
The answer to your question is a password
3 0
3 years ago
Louis wrote a check of $100 to the electricity company. After a few days he received a Notice of Dishonor from the bank regardin
diamong [38]

the checked bounced because he didn’t have any money.

mark me brainliest please!!!!!

4 0
3 years ago
What are some ways to accomplish full-duplex (FDX) digital communications on guided medium at the physical layer (OSI Layer 1)?
labwork [276]

Answer:

d. All of the above

Explanation:

Physical layer is the lowest layer of the OSI reference model that deals with the setup of physical connection to the network and with transmission and reception of signals.

Full duplex (FDx) is a bidirectional type of communication system where two end nodes send and receive data signals at the same time, and a single carrier is simultaneously used for dual communication.

To send or receive data, the participating nodes in a Full Duplex system do not have to wait for a free carrier/medium. It employs a medium that has at least two internal channels - one for sending and one for receiving.

Based on the above explanations, options A, B and C are valid and are correct ways to accomplish full-duplex (FDX) digital communications on guided medium at the physical layer (OSI Layer 1). There all of them are correct.

6 0
2 years ago
When working with a large worksheet, you can split the window into ____ panes.?
krek1111 [17]
When working with a large worksheet, you can split the window into two or four panes.
5 0
3 years ago
What errors does the grammar tool find? Choose all that apply
Anestetic [448]

Answer:

2

Explanation:

Because comma splices are not a thing.

(at least i don't think they are)

7 0
2 years ago
Other questions:
  • The term used to describe an electronic device, operating under the control of instructions stored in its own memory, that can a
    7·1 answer
  • Your Economics teacher has asked you to create a chart showing how supply and demand affects the price of gasoline. Which applic
    13·2 answers
  • Write a while statement that prints all even numbers between 1 and 100 to the screen.
    6·1 answer
  • What term is used to describe a list of security policies that is associated with an object?
    6·1 answer
  • Cognitive psychology is the scientific study of what
    9·1 answer
  • Before you give your presentation to an audience, you should make sure that your ideas are organized in a clear and meaningful w
    8·2 answers
  • _____ is a problem-solving technique where each problem in a database is stored with a description and keywords that identify it
    10·1 answer
  • Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
    8·1 answer
  • What sound customization option would you use in Scratch to simulate a sound happening in a large, empty room (like a theater)?
    8·1 answer
  • 2. What are some other reasons why you might need to know the operating system version on your computer or mobile device
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!