Question: please answer the code using java and use the following class clock 4. We already designed the class Clock to implement the time of day

please answer the code using java and use the following class clock

please answer the code using java and use the following class clock4. We already designed the class Clock to implement the time ofday in a program. We mentioned in lecture that certain applications, inaddition to hours, minutes, and seconds, might require us to store thetime zone. Derive the class ExtClock from the class Clock by adding

4. We already designed the class Clock to implement the time of day in a program. We mentioned in lecture that certain applications, in addition to hours, minutes, and seconds, might require us to store the time zone. Derive the class ExtClock from the class Clock by adding a data member to store the time zone. Add the necessary methods and constructors to make the class functional. Also, write the definitions of the methods and the constructors. Write a test program to test your ExtClock class. The class ExtClock should contain the following methods and data member: static String array data member with values: EST, CST, MST, PST, EDT, CDT, MDT, PDT zone data member default constructor constructor with parameters setZone(x) getZonel) printTime() toString() equals(x) makeCopy(x) getCopy) 1/Method to increment the time by 1 second, 1/Postcondition: Time is incremented by 1 second, //If the before-increment time is 23:59:59, the time 1/is reset to 00:00:00. public void increment Seconds() { sec++; l/increment the value of sec by 1 if (sec > 59) 1/if sec is greater than 59 { sec = 0; //set sec to O increment Minutes(); //increment min } } //Method to increment the time by 1 hour. //Postcondition: Time is incremented by 1 hour. //If the before-increment time is 23:45:53, the time //is reset to 00:45:53. public void increment Hours() { hr++; //increment the value of hr by 1 if (ht > 23) //if hr is greater than 23, hr = 0; //set hr to O } //Method to print the time. //Postcondition: Time is printed in the ll form hh:mm:ss. public void print Time() { if (hr We'll use this method to paint Clock objects in form hromin: sec if (min

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!