Question: revise the client program ( main . cpp ) to test the other operators. They are - - ( pre and post decrement ) ,
revise the client program maincpp to test the other operators. They are pre and post decrementsubtract Note: need to check for negative results and error if that is the case the insertion operator get dimensions from the terminal operator and the other five comparison operators and
main.cpp:
#include
#include "rectangleType.h
using namespace std;
int main
rectangleType rectangle;
rectangleType rectangle;
rectangleType rectangle;
rectangleType rectangle;
cout "rectangle: rectangle endl;
cout "rectangle: rectangle endl;
rectangle rectangle rectangle;
cout "rectangle: rectangle endl;
rectangle rectangle rectangle;
cout "rectangle: rectangle endl;
if rectangle rectangle
cout "Area of rectangle is greater than the area
of rectangle endl;
else
cout "Area of rectangle is less than or equal to the area
of rectangle endl;
rectangle;
cout "After increment the length and width of
"rectangle by one unit,
rectangle:
rectangle endl;
rectanglerectangle;
cout "New dimension of rectangle: rectangle endl;
cout "New dimension of rectangle: rectangle endl;
return ;
rectangleType.h:
#ifndef HrectangleType
#define HrectangleType
#include
using namespace std;
class rectangleType
Overload the stream insertion and extraction operators
friend ostream& operatorostream& const rectangleType &;
friend istream& operatoristream& rectangleType &;
public:
void setDimensiondouble l double w;
double getLength const;
double getWidth const;
double area const;
double perimeter const;
Overload the arithmetic operators
rectangleType operator const rectangleType & const;
rectangleType operator const rectangleType & const;
rectangleType operator const rectangleType& const;
Overload the increment and decrement operators
rectangleType operator ; preincrement
rectangleType operator int; postincrement
rectangleType operator ; predecrement
rectangleType operator int; postdecrement
Overload the relational operators
bool operator const rectangleType& const;
bool operator const rectangleType& const;
bool operator const rectangleType& const;
bool operator const rectangleType& const;
bool operator const rectangleType& const;
bool operator const rectangleType& const;
constructors
rectangleType;
rectangleTypedouble l double w;
protected:
double length;
double width;
;
#endif
rectangleType.cpp:
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
