Create the definitions of the methods and the constructors


Discuss the below:

Q1. In the example 1-1, the class Clock was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you 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. Finally, write a test program to test your class.

Q2. In the example 2-1, the class Date was designed to implement the date in a program, but the method setDate and the constructor with parameters do not check whether the date is valid before string the date in the data members. Rewrite the definitions of the method setDate and the constructor with parameters so that the values of month, day, and year are checked before storing the date into the data members. Add a method is LeapYear to check whether a year is a leap year. Then, write a test program to test your class.

Attachment:- class Clock.rar

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create the definitions of the methods and the constructors
Reference No:- TGS01935265

Now Priced at $25 (50% Discount)

Recommended (93%)

Rated (4.5/5)