Create a dice rolls application that displays 5 rolls of two dice java exercise 14

Answers

Answer 1

Below is the code required to Create a dice rolls application that displays 5 rolls of two dice in Java.

Here is a Java program that displays 5 rolls of two dice:

import java.util.Random;

public class DiceRolls {

   public static void main(String[] args) {

       Random random = new Random();

       int rolls = 5;

     

        for (int i = 0; i < rolls; i++) {

           int die1 = random.nextInt(6) + 1;

           int die2 = random.nextInt(6) + 1;

           int sum = die1 + die2;

           System.out.println("Roll " + (i+1) + ": " + die1 + " + " + die2 + " = " + sum);

       }

   }

}

Explanation:

We start by importing the Random class from the java.util package, which we will use to generate random numbers for the dice rolls.We then create an instance of the Random class using the new operator.We set the number of rolls we want to display to 5 using an integer variable rolls.We then use a for loop to generate and display each roll.Inside the loop, we generate two random numbers between 1 and 6 (inclusive) using the nextInt method of the Random class, and store them in the die1 and die2 variables.We then compute the sum of the two dice rolls and store it in the sum variable.Finally, we display the roll number (i+1), the individual rolls of each die, and the sum of the two dice rolls using System.out.println() method.

For more such questions on Java: brainly.com/question/30354647

#SPJ4


Related Questions

JH is the geometric mean of which two segments?

Answers

Answer:

J is 90° while H is 180°

If a 1 = 10 a 1 ​ =10 and a n = 2 a n − 1 a n ​ =2a n−1 ​ then find the value of a 5 a 5 ​ .

Answers

Answer:

5n+32a=5

Step-by-step explanation:

.

Can someone solve 8 and 9??? (Will give brainliest!!!)

Answers

The amount of curry that would be needed is 1/2

Margerite would need 3 * 4 / 5 to make the batches of cookies

How to solve the fractions

8. If Harry is doubling the recipe and the recipe is originally said to be 2/8 of curry we would have

2 * 2/8

= 4/8

= 1/2

9. If one batch of chocolate chips is made with 4/5 cups of chips

In order to make 3 batches, Margerite would have to use 3 * 4 / 5

= 12 / 5

Option C is correct

Read more on fractions here:https://brainly.com/question/78672

#SPJ1

divide $25 for 2 people in the ratio 2:3​

Answers

10 and 15

add 2 and 3 together then divide 25 by that and then multiply that number by 2 and 3 to find both of the answers

Quadrilateral hgfj is a rhombus. gf=16 cm and m∠ghk=42°. what is jf and m∠kgh? enter your answers in the boxes.

Answers

The value of JF = 16 cm and m ∠KGH = 48° in quadrilateral HGFJ which is a rhombus.

What is a rhombus?

A parallelogram is a particular instance of a rhombus. The opposing sides and angles in a rhombus are parallel and equal. A rhombus also has equal-length sides on each side, and its diagonals meet at right angles to form its shape. The rhombus is also referred to as a diamond or rhombus. Rhombi or rhombuses are the plural forms of rhombus.

Quadrilateral HGFJ is a rhombus.

GF=16 cm and m∠GHK=42°.

The diagonals of the rhombus bisect each other at the right angle.

So,

m ∠KGH = 180 - 90 - 42

m ∠KGH = 48°.

And JF = GF = 16 cm.

m ∠KGH = 48°.

And JF = GF = 16 cm.

Hence, the value of JF = 16 cm and m ∠KGH = 48° in quadrilateral HGFJ which is a rhombus.

Learn more about rhombus here:

https://brainly.com/question/27870968

#SPJ1

Complete the two column proof ?

Answers

The required statements and reasons to complete the two column proof are explained below.

What are similar triangles?

When on  comparison the corresponding length of sides of two triangles have some common properties, then they are said to be similar. Though similarity does not imply congruency.

The complete two column proof is shown as thus:

      STATEMENT               REASON

1. FG/FH = KJ/KH              Given

2. <H ≅ <H                        Reflexive property

3. ΔFHK ~ ΔGHJ               Two pairs of corresponding sides are proportional

Learn more about similar triangles at https://brainly.com/question/26068068

#SPJ1

20% of 230 is what number?

Answers

Answer:

First, you need to calculate your grade in percentages. The total answers count 230 - it's 100%, so we to get a 1% value, divide 230 by 100 to get 2.30. Next, calculate the percentage of 20: divide 20 by 1% value (2.30), and you get 8.70% - it's your percentage grade.

Step-by-step explanation:

i think sooooo

what is perpendicular line calculator online

Answers

A perpendicular line calculator online is a tool used to find the equation of a line that is perpendicular to a given line and passes through a given point.

A perpendicular line calculator online is a math tool used to find the equation of a line that is perpendicular to a given line and passes through a given point. To use this calculator, users input the slope and y-intercept of the given line, as well as the x- and y-coordinates of the given point.

The calculator then uses the formula for the slope of a perpendicular line to find the slope of the new line and calculates the y-intercept by plugging in the given point. This tool is useful in many applications, such as finding the equation of a perpendicular bisector, a perpendicular tangent line, or a perpendicular distance between two points.

Learn more about Perpendicular Line:

https://brainly.com/question/1202004


#SPJ4

A punch bowl contained 2 liters of ginger ale, 1 liter of raspberry juice

Answers

Answer:

You can drink it thank u for asking

2. Which number is an irrational number?
A √121
B √150
C√400
D√1,000,000

Answers

An irrational number of the numbers are,

⇒ √150

What is Rational number?

A number which can be written in the form of fraction p / q , where q is non zero, are called Rational numbers.

Given that;

All the numbers are,

A) √121

B) √150

C) √400

D) √1,000,000

Now, We can simplify as;

A) √121 = 11

Hence, It is a rational number.

B) √150 = 12.2474..

Hence, It is a irrational number.

C) √400 = 20

Hence, It is a rational number.

D) √1,000,000 = 1,000

Hence, It is a rational number.

Thus, An irrational number of the numbers are,

⇒ √150

Learn more about the rational numbers visit:

https://brainly.com/question/12088221

#SPJ1

How to convert grams into moles?

Answers

Answer:

use a calculator online

Step-by-step explanation:

Calculating the Molecular Mass

Gather the necessary tools for solving a chemistry problem. Having everything you need easily accessible will simplify the process of solving the assigned problem. You will need the following:

A pencil and paper. Calculations are easier to solve when you write them out. Be sure to show all your steps to get full credit.

A periodic table. You will need to be able to find atomic weight of elements using the periodic table.

A calculator. Calculators are necessary to simplify calculations of complex numbers.

Using the table below, check which graphs are proportional and which graphs are not proportional..

Answers

Graphs - 9, 10, and 12 are classified as non-proportional graphs and Graph 11 will be a Proportional graph.

Proportional and non-proportional graphs:  

A proportional graph is a graph that represents a proportional relationship between two variables. In other words, as one variable increases, the other variable also increases, and the relationship between the two variables can be expressed as a constant ratio or proportion.  

In a proportional graph, the plotted points will lie on a straight line that passes through the origin (0,0).  

Here we have

4 types of graphs  

Where

Graph - 9 is a curve and doesn't pass through the origin

Graph - 10 is a straight line and doesn't pass through the origin  

Graph - 11 is a straight line and passes through the origin

Graph - 12 is  a straight line and doesn't pass through the origin    

As we know

A proportional graph should pass through the origin and it should be a straight line.

Therefore,

Graphs - 9, 10, and 12 are classified as non-proportional graphs and Graph 11 will be a Proportional graph.

Learn more about Proportional graphs at

https://brainly.com/question/21981889

#SPJ1

20. Find the length of BC in the figure below.
A- 12
BC ?
E - 16
D - 8

Answers

Answer:

Step-by-step explanation:

First, we split the triangles into two

Δ ADC and ΔAEB

Then we look for similar things

First, both triangles have ∠A which makes the angles equal

Then we can see that side BE is // to line CD

That makes ∠D =∠E and ∠B = ∠C

Now we can have a ratio of the sides

AE/AD = AB/AC = EB/DC

AB/AC = AE/AD

12/12 + x = 16/24

Cross multiply

12 × 3 = 2 (12 + x)

36 = 24 + 2x

36 - 24 = 2x

12 = 2x

x = 6

BC = 6cm

What are the basic parts of a circle?

Answers

The basic parts of a circle are the circumference, diameter, radius, and center. The circumference is the outer boundary of the circle, and it is the distance around the circle.

The diameter is a line segment that passes through the center of the circle and connects two points on the circumference. The radius is a line segment that connects the center of the circle to a point on the circumference.

The center is the point in the middle of the circle, and it is equidistant from all points on the circumference. These four basic parts are essential to understanding the properties of circles, such as their area, circumference, and relationships between different parts.

Learn more about Circles:

https://brainly.com/question/26594685


#SPJ4

A cylinder is sliced such that the cross section is perpendicular to its bases. What is the shape of the cross section?a) circleb) rectanglec) trapezoidd) triangle

Answers

Slice a cylinder so that the cross section is parallel to the bases. The cross section is rectangular in form.

What form does a cylinder's cross section take when it is cut in half so that the cross section is parallel to the bases?

A cylinder's cross-section, for instance, is a circle when it is cut parallel to the base. The cross-sectional area of this slice is therefore equal to the area of a circle whose radius is the same as the radius of the cylinder supplied.

What form does the cross-section take?

The cross-section has a rectangular form. It is identical in size and form to the base. We will now cut it with a plane that is parallel to the base. Keep in mind that perpendicular lines cross the base at  ninety degrees.

To know more about Cylinder visit:

brainly.com/question/3987641

#SPJ1

Evaluate the following expression.
1+3²

Answers

The expression 1 + 3² can be evaluated as follows:

First, we calculate 3², which is equal to 9.

Then, we add 1 to 9, which gives us 10.

Therefore, 1 + 3² = 10.

Answer:

Step-by-step explanation:

1 +[tex]3^{2}[/tex]

= 1 + (3*3)

= 1 + 9

= 10

Given f(2)=12, which of the following could be an equation of the function?
A. f(x)=8x-2
B. f(x)= 4x+4
C. f(x)= 6x-4
D. f(x)= -4x-4

Answers

Answer:

f(x) = 4x + 4

Step-by-step explanation:

See picture below :)

what is inverse tangent derivative?

Answers

Answer:

(tan-1x)' = 1/(1 + x2)

Step-by-step explanation:

The differentiation of tan inverse x is the process of finding the derivative of tan inverse x with respect to x.

What is the conversion of 5m in feet?

Answers

5 meters is equal to 16.4042 feet.

The metre to foot formula is a mathematical expression that converts length measurements from metres to feet.

Metre is the SI unit of measurement for both length and distance.

The meter is denoted by "m".

It is denoted by the letter "ft."

To convert 5 meters (m) to feet,

Multiply the given value meters by 3.28084,

As we know that,

One meter is nearly equal to 3.28084 feet.

Therefore,

5 meters multiplied by 3.28084 gives us:

5 meters x 3.28084 = 16.4042 feet

(rounded to four decimal places)

So, 5 meters is nearly equal to 16.4042 feet.

For similar questions on conversion of meter to feet,

https://brainly.com/question/28514365

#SPJ4

how to convert 33 inches to feet?

Answers

As per the conversion factor, 33 inches is equivalent to 2.75 feet.

When we want to convert one unit to another, we use conversion factors to do so. A conversion factor is a ratio that represents the relationship between two units of measurement. In this case, we want to convert inches to feet.

To convert inches to feet, we need to use the conversion factor of 1 foot equals 12 inches. This means that for every 12 inches, we have 1 foot. To convert 33 inches to feet, we divide 33 by 12.

33 inches ÷ 12 inches/foot = 2.75 feet

To summarize, we used the conversion factor of 1 foot equals 12 inches to convert 33 inches to feet. We divided 33 by 12 to get the equivalent value in feet, which is 2.75. Always remember to use the appropriate conversion factor when converting units to avoid mistakes.

To know more about conversion factor here.

https://brainly.com/question/30166433

#SPJ4

What is the conversion of 1500 meters in miles ?

Answers

To convert meter into miles we simply have to divide meter by 1609.34 so we have 1500 m as 0.9321 miles.

Unit conversion is the process of converting the measurement of a given amount between various units, often by multiplicative conversion factors that alter the value of the measured quantity without altering its effects.

The SI base unit of length is the metre (or metre; US spelling), which is denoted by the letter m.

first described in 1793 as a ten millionth of the distance between the equator and the North Pole, but was later redefined in 1799 to refer to a prototype metre bar (this bar was changed again in 1889).

The imperial unit system uses the symbol mi to designate the mile as a unit of length.

Although it was initially an English unit, it was adopted by numerous nations, each of which had a somewhat different definition. However, the English mile is 63,360 inches, 5280 feet, or 1760 yards.

Miles = meter x 0.000621

= 1500 x 0.000621

= 0.9321 miles

Learn more about Meters to Miles:

brainly.com/question/11253316

#SPJ4

Number 6 letter c, d, e

Answers

c) The experimental probability that you flip 3 heads is,

d) The experimental probability that you flip 3 tails is,

e) There are 12 times to flip 3 tails out of 200 trials of flipping 3 coins.

What is mean by Probability?

The term probability refers to the likelihood of an event occurring. Probability means possibility. It is a branch of mathematics that deals with the occurrence of a random event. The value is expressed from zero to one

Given that;

You flip 3 coins 50 times.

And, Flipping 3 tails occurs 6 times and flipping 3 heads occurs 7 times.

Hence, The experimental probability that you flip 3 heads is,

⇒ 7 / 50

And, The experimental probability that you flip 3 tails is,

⇒ 6 / 50

And, Number of times to flip 3 tails out of 200 trials of flipping 3 coins is, x

Hence, We can formulate;

x = 3/25 × 200

x = 3 × 4

x = 12

Thus, There are 12 times to flip 3 tails out of 200 trials of flipping 3 coins.

Therefore, we get;

c) The experimental probability that you flip 3 heads is,

d) The experimental probability that you flip 3 tails is,

e) There are 12 times to flip 3 tails out of 200 trials of flipping 3 coins.

Learn more about the probability visit:

https://brainly.com/question/13604758

#SPJ9

Help with attached problem (algebra 1, functions)

Answers

The values of the function g⁻¹(2) is  {(12, 0), (14, -4), (-4, -14), (-18, 18)}, h⁻¹(x) is  11x / (x + 14) and (h o h⁻¹)(2) is 235 / 176

What is a function

In mathematics, a function is a relation between a set of inputs, called the domain, and a set of outputs, called the range, such that each input is associated with exactly one output.

More formally, a function f from a set A to a set B is a rule or correspondence that assigns to each element x in the set A exactly one element y in the set B. The set A is called the domain of the function, and the set B is called the range or codomain. The output y is called the image of x under the function f, and is often denoted as f(x).

From the question;

g = {(0, 6), (2, -7), (7, 2), (9, -9)}

h(x) = (x + 14) / 11

g⁻¹(2) = {(12, 0), (14, -4), (-4, -14), (-18, 18)}

h⁻¹(x) = 11x / (x + 14)

(h o h⁻¹)(2) = 235 / 176

Learn more on functions here;

Hey this is for arc length and the question says to assume all possible diameters are actual diameters

Answers

The length of arc FGE is given as follows:

230º.

What does the angle addition postulate state?

The angle addition postulate states that if two angles share a common vertex and a common angle, forming a combination, the larger angle will be given by the sum of the smaller angles.

The entire circumference has an angle measure of 360º, while the arc EH has an angle measure of 130º, hence the length of arc FGE is obtained as follows:

x + 130 = 360

x = 360 - 130

x = 230º.

More can be learned about the angle addition postulate at https://brainly.com/question/24782727

#SPJ1

what is the 95 % conversion in decimal ?

Answers

The 95 % conversion in decimal is 0.95.

To convert a percentage to a decimal, you divide the percentage by 100.

Therefore, to convert 95% to a decimal, you divide 95 by 100:

95 ÷ 100 = 0.95

So, 95% as a decimal is 0.95.

A percentage is a fraction expressed as a fraction of 100 in mathematics. It is frequently used to express percentages, rates, or frequencies in terms of 100. For example, if 95 out of 100 people agree on something, we can express this as a 95% probability.

To convert a percentage to a decimal, simply divide it by 100. The outcome is a number between 0 and 1, with 1 representing the entire (or 100%). In the case of 95%, dividing by 100 yields 0.95 as the decimal equivalent.

Simply multiply a decimal by 100 to convert it to a percentage. To convert 0.95 to a percentage, multiply it by 100 to get:

0.95 x 100 = 95%

As a result, percentages and decimals are two different ways of representing the same value. While percentages are frequently used to express proportions or rates, decimals are frequently used in mathematical computations or scientific notation.

For more question on percentage click on

https://brainly.com/question/24877689

#SPJ4

A __________ distribution summarizes the information from one variable ONLY, without considering ANY information from another variable.
A- joint ("and").
B- conditional.
C- marginal.

Answers

A option (c) marginal distribution summarizes the information from one variable ONLY, without considering ANY information from another variable.

A distribution is a mathematical function that shows the likelihood of different values occurring for a given variable.

Now, a marginal distribution summarizes the information from one variable ONLY, without considering ANY information from another variable. It shows the probability of each value occurring for that variable.

In mathematical terms, we can represent a marginal distribution as follows:

P(X = x) = ∑P(X = x, Y = y) for all possible values of y

Here, X is the variable we're interested in, and Y is the other variable that we're not considering. P(X = x) is the probability of X taking on the value x, and P(X = x, Y = y) is the joint probability of X taking on the value x and Y taking on the value y. The summation is taken over all possible values of y.

Therefore, option (c) is correct.

To know more about distribution here.

https://brainly.com/question/29062095

#SPJ4

How do you write an equation of a line so that it is parallel or perpendicular to a given line through a given point?

Answers

Answer:

The slope of a parallel line are equal,and the slope of perpendicular line are opposite reciprocals

What is the income threshold for self-employed workers to file a return?

Answers

Answer:

$400 or more

Step-by-step explanation:

im pretty sure:)

Evaluate the expression. −8÷−4 CLEAR CHECK −2 −12 12 2

Answers

Evaluate the expression is -10.

How should examples of expressions be evaluated?

You must replace each variable with a number and carry out the arithmetic procedures to evaluate an algebraic expression. As 6 + 6 = 12, the variable x in the preceding example is equal to 6. We can replace our variables with their values if we know what they are, then evaluate the expression after doing so.

The division can be done as follows when assessing the phrase 8 4:

−8 ÷ −4 = 2

The expression is thus reduced to:

2 - 12

12 is subtracted from 2 to yield:

-10

Thus, -10 is the correct response.

To know more Evaluate the Expression about

https://brainly.com/question/21469837

#SPJ1

how to convert 159 lbs to kg?

Answers

On converting 159 lbs to Kg , we get 159 pounds is equivalent to 72.1211 Kilogram .

The various units that are used to measure the weight of an object , some of them are : Kilogram (Kg) , Pounds (lb) , Gram (gm) .

We have to convert 159 lbs to Kilogram ;

We know that , 1 pound is equal to 0.453592 Kg ;

So , the conversion factor is 0.45359237 kg per pound.

For the conversion , we multiply the given weight by this conversion factor ,

We get ;

⇒ 159 lbs × 0.45359237 kg/lb = 72.1211 Kg ;

Therefore, 159 pounds is equal to 72.1211 Kilograms .

Learn more about Conversion here

https://brainly.com/question/30395892

#SPJ4

Other Questions
Read the scenario below and select the form of government it hasIn the [make believe] country of Atlantis, the people enjoy many freedoms. They have the right to vote and can select their own government. During their past election, the citizen of Atlantis voted for representatives for their legislative branch. A couple of weeks later the members of the newly elected legislative branch voted for the country's new leader.AutocracyAbsolute MonarchyParliamentary DemocracyPresidential Democracy Determine whether the given value of the variable is a solution of the equation Malcolm pretends that he is too evil to become king in order to:________ Explain the idioms related to emotions in your own wordsWrite an example sentence or sentences to demonstrate the meaning of the idioms in context.over the moondown in the dumpscheesed offhit the roofsick as a parrot one product was O2 (oxygen gas). What was the evidence of this gas? Which drug, depending on the dosage, can be a hallucinogen, stimulant, depressant, or painkiller? a. marijuana b. opium c. PCP d. caffeine Jess travels 196km to visit her cousins. She leaves home at 8:00am and arrives there are11:15am. Calculate her average speed in km per hour to the nearst whole number. What number is shown by Point K on the number line?The number line has numbers from 337 to 387 in increments of 5. Point K is between 367 and 377. hi-tek shoes is a private firm that has decided to issue shares of stock to the general public. this stock issue will be referred to as a(n): initial public offering. public service offering. open-end sale. break-out issue. initial trial issue. A force of 100 N was necessary to lift a rock. A total of 150 J of work was done, How far was the rock lifted? A circle has diameter 6 cm. Calculate the area of the circle. Give the units of your answer. which is not a means by which the southern states bypassed the fifteenth amendment? A. poll taxesB. the grandfather clauseC. violent intimidation tacticsD. separate "Black" elections thesis statement for the stock market crash and the great depression. a fishing pole is 2.00m long and inclined to the horizontal at an angle of 20 degrees. what is the torque exerted by the fish about an axis perpendicular to the page and passing through the hand of the person holding the pole? according to mr. cochran you may resort to civil disobedience if your cause is just, it affects most people, you have tried to work through the system, you are willing to pay the fine and/or go to jail, and you remain non-violent.True/False how many feet in acre when a user issues a command to run an application, the operating system locates the application in memory and loads it into storage. (T/F) Task 3: Look at each sentence below. The noun phrases are very short. Can you improve the sentences by expanding the noun phrase and adding a relevant prepositional phrase to give the reader more detail? 1. The car drove down the road.Ans: The impressive sports car with huge, black tyres drove down the winding country road.2. The woman climbed the mountain. Ans: ? 3. There was a spider climbing up the wall Ans: ? 4. The children ate the picnic Ans: ? 5. The cat chased the mouse Ans: ? Why is skin an organ? 25 points. Please show working out!