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
In 1–2 sentences, describe how you would create a border around a group of cells
iragen [17]
Pick one of the cells you<span> want to format and then click the down arrow beside the </span>Borders<span> button in the Font </span>group<span> on the Home tab. A drop-down menu comes up with all the</span>border<span> options that </span>you can<span> apply to the </span>cell<span> selection</span>
4 0
3 years ago
Read 2 more answers
Which of the following statements is true? a. Predicate methods typically test a condition and modify the object on which they'r
egoroff_w [7]

Answer:

C

Explanation:

Predicate methods typically test a condition and do not modify the object on which they're called.

3 0
3 years ago
Suppose a local area network requires eight characters for a password. The first character must be a letter, but the remaining s
Elis [28]

Answer: 2037468266496

Explanation:

The question says first character must be a letter = A - Z ( 26 characters )

Others can either be letters or digits = digits with range 0-9 ( 10 digits )

From the second to the seventh character can either be digits or letter hence we have ( 10 +26 ) = 36 chances

Considering rule of product

Number of chances/outcomes of the password = ( 26×36⁷)

The power of 7 was as a result of remaining seven characters can be either a letter or digits.

5 0
3 years ago
Why ada lovelace is known as first computer programmer ?​
Murrr4er [49]

Answer:

Ada Lovelace, is known as the fist computer programmer because she was the one who proposed / invented computer programming.

Basically the first person to realize that the analytical engine could "perform arbitrary tasks and wrote programs for those arbitrary task, beyond computational operations."

Hope this helps :)

3 0
3 years ago
Which part lets you point to objects on your screen, click on them, and even move them?
Vadim26 [7]

Mouse lets you point to objects on your screen, click on them, and even move them.

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs.

A computer mouse is a handheld hardware input device that controls a cursor in a GUI (graphical user interface) for <em>pointing, moving and selecting text, icons, files, and folders</em> on your computer.

Find out more on mouse at: brainly.com/question/22247989

8 0
2 years ago
Other questions:
  • What is binary in computer science ​
    11·1 answer
  • As a bank employee, you often work from home and remotely access a file server on the bank’s network to correct errors in financ
    8·1 answer
  • There is usually a positive side and a negative side to each technology improvement. Select a technology you use every day and c
    5·1 answer
  • What type of application would be appropriate for learning a foreign language?
    15·2 answers
  • Please its argent and I will give you BRAINLIEST ANSWER 6. How would you confirm that a colourless liquid given to you is pure w
    10·1 answer
  • SLA:
    14·1 answer
  • Gn guys have an Amazing day!
    12·2 answers
  • Define power supply and types of power supply<br>​
    11·1 answer
  • Laptops are used for accessing the internet. Name two advantages and two disadvantages for using a laptop rather than a smartpho
    5·2 answers
  • Which of the following is an example of phishing attack? csp
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!