Question: Please write code in Java with explanations so, I can understand. Thank you! Write a program with the following requirements and conditions In your program

Please write code in Java with explanations so, I can understand.

Thank you!

Please write code in Java with explanations so, I can understand. Thank

Write a program with the following requirements and conditions In your program you're supposed to be able to create different kind of clocks. You will need a base class called Clock. This class should have a parameter (or parameters) to save the current time. This object should also have a function called displayCurrentTime0. When this function is called, it should output the current time to the console. The class also should have a String parameter called "Make" Next, you will create three subclasses that inherit from Clock, those three classes are Watch, PendulumClock, and DigitalClock. The Watch class should have a private parameter called alarm, which can hold a specific time to save an alarm. It also should provide a public get and set function for this parameter. The PendulumClock should have a function called windUp). When this function is called, it should set an internal parameter to currentTime +24h. When the user requests the time from a PendulumClock, only if the 24h haven't passed since the last wind-up, the current time should be displayed, otherwise a message should be output that says: "Please wind up the clock." (hint: you will need to override the function from the base class) The DigitalClock should be able to be manually set. That means it should have a function called setTime, which will set the time to whatever the user inputs and passes to the function, and when asked again what the current time is it should accurately keep track of timekeeping based on the new time set. (hint: you might want to save the time difference in a private property if the time is manually set, so anytime the time is requested, you will know how to calculate the difference from the current time upon request) Write a program with the following requirements and conditions In your program you're supposed to be able to create different kind of clocks. You will need a base class called Clock. This class should have a parameter (or parameters) to save the current time. This object should also have a function called displayCurrentTime0. When this function is called, it should output the current time to the console. The class also should have a String parameter called "Make" Next, you will create three subclasses that inherit from Clock, those three classes are Watch, PendulumClock, and DigitalClock. The Watch class should have a private parameter called alarm, which can hold a specific time to save an alarm. It also should provide a public get and set function for this parameter. The PendulumClock should have a function called windUp). When this function is called, it should set an internal parameter to currentTime +24h. When the user requests the time from a PendulumClock, only if the 24h haven't passed since the last wind-up, the current time should be displayed, otherwise a message should be output that says: "Please wind up the clock." (hint: you will need to override the function from the base class) The DigitalClock should be able to be manually set. That means it should have a function called setTime, which will set the time to whatever the user inputs and passes to the function, and when asked again what the current time is it should accurately keep track of timekeeping based on the new time set. (hint: you might want to save the time difference in a private property if the time is manually set, so anytime the time is requested, you will know how to calculate the difference from the current time upon request)

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!