Question: Exercises 4 . 4 Create a class named Time 2 which contains three variables: hour ( an int between 1 and 2 4 inclusive )
Exercises
Create a class named Time which contains three variables: hour an int between and inclusive minute an int between and inclusive and second an int between and inclusive
Include five overloaded constructors listed below:
The first constructor initializes the Time object to ::
The second constructor initializes the Time object with a given hour, minute, and second.
The third constructor initializes the Time object with a given hour eg::
The fourth constructor initializes the Time object with a given hour and minute eg::
The fifth constructor initializes the Time object with another Time object.
In addition to the mutators and accessors, the class also includes the following methods:
militaryTime which returns the time in the format of ::
standardTime which returns the time in the format of :: PM
Add a TimeTest class with the main method called TimeTest. In the main method, create five objects of Time class, each matching a constructor of the Time class. Then, display all five objects in both military and standard time formats.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
