Question: coding in java Define a method named coinflip that takes a Random object and returns 'Heads or Tails' according to a tandom value 1 or

coding in java
coding in java Define a method named coinflip that takes a Random

Define a method named coinflip that takes a Random object and returns 'Heads" or "Tails' according to a tandom value 1 or 0. Assume the Value 1 represents "Heads" and 0 represents "Tais". Then, write a main program that rends the desired number of coinflips as an input, calls method coinfip() repeatedly according to the number of coin fips, and outputs the results. Assume the input is a value greater than 0 Ex. If the random object is created with a seed value of 2 and the input is: the output is: Heada Tas a Hends Note. For testing purposes. a Random object is created in the main0 method using a pseudo.random number generator with a fxed seed value. The program uses a seed value of 2 during development, but when submitted, a different seed value may be used for each test case The program must define and call the following method public statle string coinfllp(Randon rand) LabProgram java Coad sefaut template. 1 inoort Java. otilisconner; 2 inport jovs. vtili.aandon; 3 . public claws Laberogran f I. Deflie your hethou here % public static vold main (Stringt) arts) if Scanner sonr - new Scanner ( System, in)s flandoe rand - new Randon(2)i // Seed used in devetom nodr. II Add more warlables as needed \% Tope your cooe nere. % 14 1 isic} Run your program as often as youd like, before submitting for grading Belaw. type any needed input values in the first box, then click Run program and observe the programs outbut in the second box

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!