Question: Using C++ PRG-1. Create a class named Time that dermes a porms, minutes, and seconds and specifies AM or PM. Hours can be between 1
PRG-1. Create a class named Time that dermes a porms, minutes, and seconds and specifies AM or PM. Hours can be between 1 and 12 , minutes can be between 1 and 59 , and seconds can also be between 1 and 59. Also define an integer that can be 0 or 1 to represent AM or PM. Create a default constructor that sets the time to midnight. Overload the prefix ++ to add one second to the time (representing each tick of the clock). Overload the operator() to find the duration of time from midnight in seconds. Overload the operator += to add a duration of times (in seconds) to get a new point of time. PRG-2. Design a Complex class representing complex numbers. A complex number in mathematics is defined as x+iy where x defines the real part of the number and y is the imaginary part. The letter i represents the square root of -1 (which means i2 is -1 ). Include operator functions to overload the operators +=,=, =,/= and the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
