$29.99
CS 2401
Lab 1: Operator Overloading
Download the MyTime.h and MyTime.cc files provided with this assignment. In this example you will see
implementations for four arithmetic operators, three Boolean operators and the input and output
operators. They have all been implemented as friends of the MyTime class.
Requirements:
1. Implement all 9 operators without using friends.
a. For the Boolean and arithmetic operators, you should do this by making the operators
members of the MyTime class. Make sure you use const to protect the object which is
being used as the left-hand operand as well as the object that is passed in (-½ point each
time you miss a const).
b. For the I/O operators you should do this by writing input and output functions in the
class that do the job of the operator, and then have the operator call that member
function. The prototypes for the input and output functions are included in the MyTime
class.
2. Combine the two constructors into a single constructor by using default arguments.
3. Write an application that allows the user to enter two times and a scalar, and then see all the
math and at least one of the Boolean operators performed on those objects.
4. Run the script command by typing:
script lab1output.txt
run your program with your test input, and then ctrl-d to quit.
To submit, attach your completed program files and the script file to the assignment on Blackboard. (To
do this you click on the name of the assignment and then look for the “Browse My Computer” button.)