SER 200 Demonstrates Something Great/tutorialoutletdotcom SER 200 Demonstrates the use of the Bus Class
SER 200 Demonstrates the use of the Bus Class
FOR MORE CLASSES VISIT
www.tutorialoutlet.com
Q4: Create a Time class. This class will represent a point in time, such
as a departure time. It should contain 2 constructors, 2 instance
variables (hour and minute), and 10 methods (see below). All
methods but toString should be in terms of the 24 hour format. [30
points]
default constructor: Creates a Time object for 12:00AM.
overloaded constructor: Creates a Time object at a specific hour and
minute.
getHour(): Returns an integer representing the hour of the Time
object.
getMinute(): Returns an integer representing the minute of the Time
object.
addHours(...): Updates the object by moving it forward a number of
hours.
addMinute(...): Updates the object by moving it forward a number of
minutes. (Hint: Be careful that you don't allow minutes to be more
than 59.)
addTime(...): Updates the object by moving it forward by the hour
and minute from another Time object.
getCopy(): Returns a new Time object that has the same hour and
minute of the existing Time object.