Question: Design, implement, and test a class that represents an amount of time in minutes and seconds. The class should provide a constructor that sets the
Design, implement, and test a class that represents an amount of time in minutes and seconds. The class should provide a constructor that sets the time to a specified number of minutes and seconds. The default constructor should create an object for a time of zero minutes and zero seconds. The class should provide observers that return the minutes and the seconds separately, and an observer that returns the total time in seconds (minutes times 60 + seconds). Boolean comparison observers should be provided that test whether two times are equal, one rime is greater than the other, or one time is less than the other. (You may use RelationType and function ComparedTo if you choose.) A function should be provided that adds one rime to another, and another function that subtracts one tune from another. The class should not allow negative times (subtraction of more time than is currently stored should result in a time of 0:00). This class should be immutable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
