Question: Before coding you have to create a design document. Here is a short excerpt from your book regarding design documentation: Example 1: : see like

Before coding you have to create a design document. Here is a short excerpt from your book regarding design documentation:

Example 1: : Before coding you have to create a design document. Here is a

see like this you need to create a diagram like this for this coding.

you will need to create a design document of the tossing Coins for a Dollar.

Java programming language!

12. Coin Toss Simulator

Write a class named Coin. The coin class should have the following field:

A String named sideUp. The sideUp field will hold either "heads" or "tails" indicating

the side of the coin that is facing up.

The Coin class should have the following methods:

A no-arg constructor that randomly determines the side of the coin that is facing up

("heads" or "tails") and initializes the sideup field accordingly.

A void method named toss that simulates the tossing of the coin. When the toss method is called, it randomly determines the side of the coin that is facing up ("heads or "tails") and sets the sideUp field accordingly.

A method named getSideUp that returns the value of the sideUp field.

Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 20 times. Each time the coin is tossed, display the side that is facing up. The program should keep count of the number of times heads is facing up and the number of times tails is facing up and display those values after the loop finishes.

Tossing Coins for a Dollar

For this assignment you will create a game program using the Coin class from Programming Challenge 12. The program should have three instances of the Coin class: one representing a quarter, one representing a dime, and one representing a nickel.

When the game begins, your starting balance is $0. During each round of the game, the program will toss the simulated coins. When a coin is tossed, the value of the coin is added to your balance if it lands heads-up. For example, if the quarter lands heads-up, 25 cents is added to your balance. Nothing is added to your balance for coins that land tails-up. The game is over when your balance reaches one dollar or more. If your balance is exactly one dollar, you win the game. You lose if your balance exceeds one dollar.

Then ALSO, you will need to create a design document of the tossing Coins for a Dollar. so when making this code for coins for a dollar. You need to make a design document just like in example 1.

While planning a program, the programmer uses one or more design tools to create a model of the program. Three common design tools are hierarchy charts, flowcharts, and pseudocode. A hierarchy chart is a diagram that graphically depicts the structure of a pro- gram. It has boxes that represent each step in the program. The boxes are connected in a way that illustrates their relationship to one another. Figure 1-10 shows a hierarchy chart| for the pay-calculating program. Calculate Gross Pay Get Payroll Data from User Multiply Hours Worked by Pay Rate Display Gross Pay Read Number of Hours Worked Read Hourly Pay Rate A hierarchy chart begins with the overall task, and then refines it into smaller subtasks. Each of the subtasks is then refined into even smaller sets of subtasks, until each is small

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!