Page 1 of 1

*JAVA* Objectives •Design a class MyTime to handle time in Hours,Minutes and Seconds •Code the class with fields and met

Posted: Sun May 15, 2022 10:06 am
by answerhappygod
*JAVA*
Objectives
•Design a class MyTime to handle time in Hours,Minutes and
Seconds
•Code the class with fields and methods
•Define and use the class
Hand-in Requirements
•MyTime.java
TestMyTime.java
Tasks
The class should allow users use time in HH:MM:SS format. You
should have fields such
as Hour, Minute and Second as integers as well as Hours which id a
double. You should
implement methods to convert Hour, Minute and Second to Hours and
Hours to Hour,
Minute and Second format. There should be methods to display time
in HH:MM:SS
format.
Your class "MyTimes" should have constructors that can instantiate
the class with
initial time of three parameters in Hour, Minute, Second form or
single parameter of
Hours
Add methods "Add" that will allow two times to be added
Add suitable accessors
Write a seperate class to "TestMyTimes" to apply the class
"MyTimes" you wrote. In this class
instatntiate "MyTimes" with both methods:
MyTimes T1 = new MyTimes(10, 20, 30);
MyTimes T2 = new MyTimes(12.56);
Demostrate the method "Add" using T1 and T2
•[20 Points] For a correct design of the class by identifying
the fields with field
types, methods, constructors and accessors.
•[60 Points] For a correct coding of the class with fields, at
least two constructors,
at least three methods, and accessors as necessary.
•[20 Points] For using the class in examples in a paperate java
application
demostrating the application of two cobstructors and all the
methods.
Upload the two java files (do not zip)