Question: C++ To the right is what failed for testing. The ones with the red X's have failed to build. My code is written below. Main.cpp______________________________

C++

To the right is what failed for testing. The ones with the red X's have failed to build. C++ To the right is what failed for testing. The ones with My code is written below.

Main.cpp______________________________

#include #include #include "rectangleType.h" using namespace std; int main() { rectangleType oldYard(20.00, 10.00); rectangleType newYard; cout

rectangleType.cpp_________________________

#include "rectangleType.h" //Default constructor rectangleType::rectangleType() { } //Parameerized consgtructor rectangleType::rectangleType(double _length,double _width) { length = _length; width = _width; } //Set Dimention function void rectangleType::setDimension(double _length,double _width) { length = _length; width = _width; } //get length function double rectangleType::getLength() { return length; } //get width function double rectangleType::getWidth() { return width; } // area function double rectangleType::area() { double area; area = length*width; return area; } // perimeter function double rectangleType::perimeter() { double perimeter; perimeter = 2*(length+width); return perimeter; } // doubleDimensions function rectangleType rectangleType::doubleDimensions() { length = 2 * length; width = 2 * width; return *this; } //print function void rectangleType::print() { cout

} //++ operator overloading rectangleType rectangleType::operator++() { length++; width++; return *this; } //-- operator overloading rectangleType rectangleType::operator--() { length--; width--; return *this; } //- operator overloading rectangleType rectangleType::operator-(rectangleType& other) { if(length operator overloading bool rectangleType::operator>(rectangleType& other) { if(area()>other.area()) return true; else return false; } //

//Input and Output operator overloading ostream & operator

istream &operator>>( istream &input, rectangleType &r ) { input >> r.length >>r.width; return input; }

rectangleType.h_____________________

#ifndef RECTANGLETYPE_H #define RECTANGLETYPE_H

#include using namespace std; #include "rectangleType.h" class rectangleType { public: rectangleType(); rectangleType(double _length,double _width); void setDimension(double _length,double _width); double getLength(); double getWidth(); double area(); double perimeter(); void print(); rectangleType doubleDimensions(); //All operator overloading functions declaration rectangleType operator++(); rectangleType operator--(); rectangleType operator-(rectangleType& other); bool operator==(rectangleType& other); bool operator!=(rectangleType& other); bool operator>(rectangleType& other); bool operator

friend ostream& operator>( istream &input, rectangleType &r ); private: double length; double width; };

#endif // RECTANGLETYPE_H

Programming Exercise (13-1) Due Tomorrow at 1 1 PM HST main.cpp rectangleType.cpprectangleType.h Back Overloading Operators 1 #include 3 #include "rectangleType.h 4 using namespace std 5 int main) Instructions Test Results This chapter uses the class rectangleType to illustrate how to overload the operators+ 3/6 passed = !s, ->, and se . In this exercise, 7 rectangleType oldYard (2.00, 10.00); 8 rectangleType newYard Code Pattern first redefine the class rectangleType by declaring the instance variables as protected and then overload additional operators as defined in parts 1 to 3. cout

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!