Assignment III
Deadline: 10-May-2010
Note: You are Required to work in multiple file system i.e., .h and .cpp files.
Q1)
Objectives
This assignment has been designed so that you would be able implement the concept of operator overloading. After the completion of this assignment you should have a good grasp on how to
Overload an operator
Call an overloaded operator for user defined data types
Assignment
Write a c++ program that compares the performance of two type-writers according to the number of words he/she types in one minute.
Create a class named TypeWriter. Following should be the data members
• Name //for the name of type writer
• Words //for the number of words he/she types in one minute
Member function should be
• Input
To take input of the data members
• Overload > operator that tells which type writer performs better after comparing the two. The type-writer that types more words in one minute is a better performer.
• Overload < operator that tells which among the two type writers performs lesser than the other.
• Overload - operator that tells how many words a better performer types more than worse performer.
You are required to display a message stating; which type writer is a better performer. Also display a statement that tells how many words a better performer types more than that of worse performer.
Write getter/setter and constructor/destructor for the class TypeWriter.
OUTPUT
Your output should be similar to the following
1-
Please enter the information about Typewriter 1
name Mark
number of words typed in one minutes 60
Please enter the information about Typewriter 2
name Henry
number of words typed in one minutes 40
Performance of Mark is better than Henry
Mark types 20 more words than Henry
2-
Please enter the information about Typewriter 1...