Question: SOS I NEED HELP This is in Java 1. Write a class called Clock. Here are the first few lines: public class Clock ( //

SOS I NEED HELP
This is in Java  SOS I NEED HELP This is in Java 1. Write a
class called Clock. Here are the first few lines: public class Clock

1. Write a class called Clock. Here are the first few lines: public class Clock ( // instance variables private int hour; private int minute; private int second; Write a default constructor for a 12-hour Clock that initializes hour, minute, and second to zero. Write accessors and mutators for all instance variables Write a toString method that will return a String representation of a Clock object using the format hour : minute second Each integer should occupy 2 digits. For example, if hour contains 12, minute contains 5, and second contains 9, the tostring method should return the String "12:05:09". In this example, you need to insert a 'o' character before the minutes and also before the seconds. Write a method called tick that will increment the number of seconds, then check to see that second, minute, and hour contain valid data. Adjust the instance variables as needed. Write an equals method that will return true if the Clock parameter has the same hour, minute, and second as the calling object

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!