Question: could someone help me answer these three questions please? Thank you Assume the following class definitions: public class Clock {private int second; private int minute;

could someone help me answer these three questions please? Thank you
Assume the following class definitions: public class Clock {private int second; private int minute; private int hour; public void print () {System.out.printf("Current time is: %d:%d:%d ", hour, minute, second);} @Override public String toString() {return String.format("Current time is: %d:%d:%d ", hour, minute, second);}} public class AlarmClock extends Clock {private boolean alarmOn; ...} a. Create a constructor with parameters for AlarmClock class which is a child class of Clock. It initializes its parent class instance variables - second, minute, and hour - and initializes its own instance variable - a boolean - alarmOn. b. Write a print method for AlarmClock class which makes Use of its parent class print method. c. Write a toString method for AlarmClock class which make Use of its parent class toString method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
