Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a java program to demonstrate this Coin class. In this program, instantiate four objects of the Coin class: one representing a quarter, one representing

Create a java program to demonstrate this Coin class.

In this program, instantiate four objects of the Coin class: one representing a quarter, one representing a dime, one representing a nickel, and one representing a penny. That is, the faceValue for them would be 25, 10, 5, and 1, respectively. After tossing the four coins, show the total by dollars. The total is calculated based on the face value of the coins landed heads-up. The program will ask the user whether he/she would like to toss again until the user chooses not to.

The output should look like this:

This program tosses four coins and get the total of values for coins landing on heads.

Ready to toss? (Y/N) y

The penny lands on Tails

The nickel lands on Tails

The dime lands on Tails

The quarter lands on Tails

The totla of the coin-tossing result is $0.0

Would yoiu like to toss again? (Y?N) yes

The penny lands on Heads

The nickel lands on Tails

The dime lands on Heads

The quarter lands on Tails

The total of the coin-tossing result is $0.11

Would you like to toss again? (Y?N) y

The penny lands on Tails

The nickel lands on Heads

The dime lands on Heads

The quarter lands on Tails

The total of the coin-tossing result is $0.15

Would you like to toss again (Y?N) n

Exit the program.

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago