Question: JAVA Write a class named . The class should have the following field:A named . The field will hold either heads or tails indicating the

JAVA 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 up.The class should have the following methods:A no-arg 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.

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 Programming Questions!