[SOLVED] Solution Chapter 12-4 PG. 639

25.00 $

Programming resource
Digital learning resource
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (3 votes)

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. Boolean comparison observers should be provided that test wheter two times are equal, one time is greater, or one time is less than the other. A function should be provided that adds one time to another, and another function that subtracts one time 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.

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.