Question: Please solve the following using java and use the clock class below to create the program clock class is provided 4. We already designed the
Please solve the following using java and use the clock class below to create the program



clock class is provided
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() The output should show the following: Initialize the myExtClock object to 05:04:30 EST Initialize the yourExtClock object to 00:00:00 Set yourExtClock to 05:45:16 CDT Determine if the 2 objects are equal Set the time for myExtClock to hours = 7, minutes = 29, and seconds = 47 (these are values entered at the keyboard) Print out the myExtClock object Increment the clock by 1 second for myExtClock and print out the myExtClock object Copy myExtClock into yourExtClock and print out the yourExtClock object Print your program to test the class ExtClock Paste the output after the program Print the Clock class (from our lecture) AND ExtClock class 7/Method to increment the time by 1 second. 1/Postcondition: Time is incremented by 1 second. 1/If the before-increment time is 23:59:59, the time 1/is reset to 00:00:00. public void increment Seconds() { sec++; //increment the value of sec by 1 if (sec > 59) //if sec is greater than 59 { sec = 0; 1/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 // form hh:mm:ss. public void print Time() { if (hr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
