Question: CODE IN C++ Please take screenshots of the code rather than copying the code & pasting the code directly to text. Use all getter &

CODE IN C++

Please take screenshots of the code rather than copying the code & pasting the code directly to text.

Use all getter & setter functions as they are given.

CODE IN C++ Please take screenshots of the code rather than copying

Problem 2: TimeSpan Design 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(1, 2, 3); is a duration of time of 1 hour, 2 minutes and 3 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 60 and 60 when stored; number of minute: should be between 60 and 60 when stored. That is, a user can create a TimeSpan object of 90 seconds, but it should be stored as 1 minute, 30 seconds. See example below You do not need to worry about integer overflow for very big TimeSpan objects. 1 void set_time(int hours, int minutes, int seconds): set the number of hours, minutes seconds. Constructors The class should define constructor(s) that receive various primitive types (specifically int, float, and double) and store them as integers. The constructor should take one, two or three arguments. If only one parameter is passed during initialization assume it is seconds. If there are two assume minutes and seconds (in that order). Perform appropriate rounding to maintain as much accuracy as possible down to the second as the smallest granularity. You should not keep fraction of seconds. Here are some examples: TimeSpan(1.5, 4, -10) represents 1 hour, 33 minutes, 50 seconds. TimeSpan (7,3) represents 6 minutes, 57 seconds. TimeSpan(-190) represents 3 minutes, 10 seconds. TimeSpan(3, -90, 120) represents 1 hour, 32 minutes. Operators The class must overload and implement the following math operators: addition, subtraction, and Unary Negation. The class must overload and implement the following comparison operators: ==,!=,

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!