Question: Problem 2 : TimeSpanDesign and implement a TimeSpan class which represents a duration of time in hours, minutes, and seconds. The order hours, minutes, and
Problem : TimeSpanDesign and implement a TimeSpan class which represents a duration of time in hours, minutes, and seconds. The order hours, minutes, and seconds should be respected in the constructor.As an example TimeSpan duration;is a duration of time of hour, minutes and seconds.In the instances of the TimeSpan class you should store the values as integers in a normalized way. The number of seconds should be between and when stored; number of minutes should be between and when stored. That is a user can create a TimeSpan object of seconds, but it should be stored as minute, seconds. See example below.You do not need to worry about integer overflow for very big TimeSpan objects.Accessor functions requiredThe TimeSpan class should implement the following member functions:int hours const; return the number of hours as an intint minutes const; return the number of minutes as an int int seconds const: return the number of Seconds as an intvoid settimeint hours, int minutes, int seconds: set the number of hours, minutes, seconds.ConstructorsThe class should define constructors that receive various primitive types specifically int, float, and double and store
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
