Background
We covered classes and objects in class this week. Lab 10 asks you to create a Coin class from scratch. You won’t modify the starter file,CoinTester.java, at all. After you add Coin.java to your directory, CoinTester.java should run without error and match the sample output.
Exercise
Your job is to build the Coin.java class, which will be used as the blueprint for Coin objects inside ofCoinTester.java. You must look atCoinTester.javato see the methods (flip(), reset(), and more!) and private fields that the Coin class needs to have. Once you have all of the requirements of the Coin class, you can build it.
Remember the things you will need for Coin.java:
Constructor method that takes in no arguments. The constructor should create a Random object.
Each of the Coin methods that are called inCoinTester.java
Private variables to keep track of important values.
Your submission should include only Coin.java. There should be no changes necessary to CoinTester.java. Remember, you might get errors inside CoinTester.java, which means there is a problem with the Coin.java code. CoinTester.java is tested and should work without any changes!
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here