Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write java program. Please look at the introduction and out put. | Project Flip a coin: Thursday February 15 (Duplicate Character games output on my
Write java program.
| Project Flip a coin: Thursday February 15 (Duplicate Character games output on my website) The game will use the random number generator of the Math class to create a coin flip. The game will ask the user to enter a number for the heads in a row the program will produce. The game will flip the "coin" until the number of heads is reached. There are two versions of the output. The first traces the program as it flips the coin and the other version just prints the number of flips it took. You must solve this problem using methods. I used 5 methods: introduction , choose helmplementation giveMeTheTracelmplementation0, giveMeJustTheAnswerlmplementation), and flipACoin). flipACoin) is the only public method and is called from the class DisplayMenu. flipACoin0 calls the other methods which are private. A random coin flip can be generated with the following code: int flip (intX(Math.random2)+ 1). If you want to have commas in the answer use the following code import java.text.DecimalFormat:// this imports the DecimalFormat class Decimal Format number Format new Decinal Format("##,###,###,###")// creates an instance of Decimal Format String stringNumber numberFormat.format(numberOfThrows); stringNumber is a String representing the int numberOfThrows with commas. See Coin Flip on my website for sample output Please look at the introduction and out put.
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