Question: Write a class named . The class should have the following field:A named . The field will hold either heads or tails indicating the side
Write a class named The class should have the following field:A named The field will hold either heads or tails indicating the side of the coin that is facing upThe class should have the following methods:A noarg constructor that randomly determines the side of the coin that is facing up heads or tails and initializes the field accordingly.A method named 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 field accordingly.A method named that returns the value of the field. JAVA
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
