Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that simulates the random flipping of two coins. At the start of the program prompt the user for the amount of

Write a Java program that simulates the random flipping of two coins. At the start of the program prompt the user for the amount of times to flip the coin. Display each flip, and afterward display the percentages of heads and tails for each coin. Also, display the percentage that both coins were heads, and the percentage both coins were tails. Output from your program might look like this:

How many times would you like to flip the coins?

2

H T

H H

Coin1 was heads 100%, and tails 0%

Coin2 was heads 50%, and tails 50%

The percentage both coins were heads was 50%

The percentage both coins were tails was 0%

Do you want to continue (Y/N)?

Y

How many times would you like to flip the coins?

5

H T

T H

H H

H H

T H

Coin1 was heads 60%, and tails 40%

Coin2 was heads 80%, and tails 20%

The percentage both coins were heads was 40%

The percentage both coins were tails was 0%

Do you want to continue (Y/N)?

n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions