Question
Program Description: The objective of this program is to flip three coins until they all land on the same side. You are collectively flipping three
Program Description:
The objective of this program is to flip three coins until they all land on the same side. You are collectively flipping three coins. Flipping both coins simultaneously will continue until they both land on the same side. Each time, you should print a statement, ending it with the total number of flips. Coin class must have a constructor, setters, getters, private instance variables, and a flip function. The coin objects will be created by your CoinTester class, which will also call the flip method, inquire about the number of flips, and print the results.
Statements Required: class, methods,
Sample output: coin 1 is on heads, coin 2 is on tails, coin 3 is on tails coin 1 is on tail, coin 2 is on heads, coin 3 is on tails coin 1 is on heads, coin 2 is on tails, coin 3 is on tails coin 1 is on tails, coin 2 is on tails, coin 3 is on tails The coins were flipped a total of 4 times.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started