Question: create a constructor as well but dont do math in the construcyir, give the variable faceUp an initial value faceUp is supposes to be to

create a constructor as well
but dont do math in the construcyir, give the variable faceUp an initial value faceUp is supposes to be to set to either 0 or 1 create a constructor as wellbut dont do math in the construcyir, give
*create a constructor as well but dont do math in the constructor give the variable an initial value, faceUp is supposed to be set to either 0 or 1

Create a Coin class that includes a variable faceUp that stores either a 0 for heads up or 1 for tails up, an accessor method named showEace that returns a bit the coin is heads up or a 1 if the coin is tails up, and a modifier method named flipcoin that assigns a random integer between 0 and 1 inclusive, to the variable face un dont include a return method for flipcoin Test the class with the following client code public static void main(String args) { Coin nickel = new Coin: nickelfinolot (nickelshowEace0 =0) { System.out.println("Heads up")) else { System.out.print Tils up")} Use the following formula to randomize a coin tip (it will return a random integer between 0 and 1) (int) (Math.random() *0.5)

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!