Question: language is java. note there should be two files. 4. Comprehensive Coin Toss Simulator, based on Gaddis programming challenge 6.16. (15 points) Write a class

language is java.

note there should be two files.

language is java. note there should be two files. 4. Comprehensive Coin

4. Comprehensive Coin Toss Simulator, based on Gaddis programming challenge 6.16. (15 points) Write a class named Coin. The Coin class should have the following field: . A private String named sideUp. The sideup field will hold either "heads" or "tails" indicating the side of the coin that is facing up. The Coin 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 sideUp field accordingly . A void method named toss 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 sideUp field accordingly. . A method named getSideUp that returns the value of the sideUp field. Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 5 times. Each time the coin is tossed, display which side is facing up. The program should keep count of the number of times heads is facing up and the number of times tails is facing up, and display those values after the loop finishes. Rubric: Student name and date is in a comment on the first line of the programs: -5 points if fails sideup field is private: -3 points if fails Coin class definition, methods, constructors: 5 points Main program loop coin toss 5 times: 5 points Main program count heads/tails outcome for all tosses: 5 points Please paste a screenshot of a successful program run, and copy-and-paste the source code from both .java files, here

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!