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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!