Question
JAVA Programming Please have the program to have user input to set the alarm for the watch and wind the clock for the pendulum clock.
JAVA Programming
Please have the program to have user input to set the alarm for the watch and wind the clock for the pendulum clock. Please I need help. Please have the program to have user input for digital clock to set the time.
Please have the program to allow user input for each of the classes.
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 displayCurrentTime(). 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 aPendulumClock, 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 calledsetTime, 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)
Extra Credit: Create and submit another UML Diagram for Exercise 2 (+10 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started