CIS 023 - Lab2 Mockups ONLINE Exercise L2-1 Chap 13 Overloading and Templates Please ensure your class header files have the exact same function names as listed below. If your class definitions do not match, I will be unable to test them. When submitting your lab assignment submit only the .cpp and .h files you created or modified. Be sure you have coded the cout statement as described in the Grading Rubric inside the contructor. In this exercise, first redefine the class rectangle Type by declaring the instance variable as protected and then overload additional operators as defined in parts A through C. A. Overload the pre- and post-increment and decrement operators to increment and decrement, respectively, the length and width of a rectangle by one unit. (Note that after decrementing the length and width, they must be positive.) B. Overload the binary operator - to subtract the dimensions of one rectangle from the corresponding dimensions of another rectangle. If the resulting dimensions are not positive, output an appropriate message and do not perform the operation. C. The operators == and != are overloaded by considering the lengths and widths of rectangles. Redefine the functions to overload the relational operator by considering the areas of rectangles as follows: two rectangles are the same, if they have the same area; otherwise, the rectangles are not the same. Similarly, rectangle yard1 is greater than rectangle yard2 if the area of yard1 is greater than the area of yard2. Overload the remaining relational operators using similar definitions. D. Write the definitions of the functions to overload the operators defined in parts A through C. E. Write a test program that tests various operations on the class rectangle Type.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Please follow the instructions given in the images below, and give us a sample of what the output will look like, thank you.

CIS 023 - Lab2 Mockups ONLINE
Exercise L2-1 Chap 13 Overloading and Templates
Please ensure your class header files have the exact same function names as listed below.
If your class definitions do not match, I will be unable to test them. When submitting
your lab assignment submit only the .cpp and .h files you created or modified. Be sure you
have coded the cout statement as described in the Grading Rubric inside the contructor.
In this exercise, first redefine the class rectangle Type by declaring the instance variable as protected and then
overload additional operators as defined in parts A through C.
A. Overload the pre- and post-increment and decrement operators to increment and decrement, respectively,
the length and width of a rectangle by one unit. (Note that after decrementing the length and width, they
must be positive.)
B. Overload the binary operator - to subtract the dimensions of one rectangle from the corresponding
dimensions of another rectangle. If the resulting dimensions are not positive, output an appropriate
message and do not perform the operation.
C. The operators == and != are overloaded by considering the lengths and widths of rectangles. Redefine
the functions to overload the relational operator by considering the areas of rectangles as follows: two
rectangles are the same, if they have the same area; otherwise, the rectangles are not the same. Similarly,
rectangle yard1 is greater than rectangle yard2 if the area of yard1 is greater than the area of yard2.
Overload the remaining relational operators using similar definitions.
D. Write the definitions of the functions to overload the operators defined in parts A through C.
E. Write a test program that tests various operations on the class rectangleType.
rectangleType.h
double area() const;
double getLength() const;
double getWidth() const;
double perimeter() const;
void setDimension(double I, double w);
friend ostream& operator<<(ostream&, const rectangle Type &);
friend istream& operator>>(istream&, rectangle Type &);
G:\CIS 23 - Data Structures and Algorithms\2020 Sprg\CIS023-Mockups Spring 2020\CIS 023 - Lab2 Mockups
ONLINE.docx
Transcribed Image Text:CIS 023 - Lab2 Mockups ONLINE Exercise L2-1 Chap 13 Overloading and Templates Please ensure your class header files have the exact same function names as listed below. If your class definitions do not match, I will be unable to test them. When submitting your lab assignment submit only the .cpp and .h files you created or modified. Be sure you have coded the cout statement as described in the Grading Rubric inside the contructor. In this exercise, first redefine the class rectangle Type by declaring the instance variable as protected and then overload additional operators as defined in parts A through C. A. Overload the pre- and post-increment and decrement operators to increment and decrement, respectively, the length and width of a rectangle by one unit. (Note that after decrementing the length and width, they must be positive.) B. Overload the binary operator - to subtract the dimensions of one rectangle from the corresponding dimensions of another rectangle. If the resulting dimensions are not positive, output an appropriate message and do not perform the operation. C. The operators == and != are overloaded by considering the lengths and widths of rectangles. Redefine the functions to overload the relational operator by considering the areas of rectangles as follows: two rectangles are the same, if they have the same area; otherwise, the rectangles are not the same. Similarly, rectangle yard1 is greater than rectangle yard2 if the area of yard1 is greater than the area of yard2. Overload the remaining relational operators using similar definitions. D. Write the definitions of the functions to overload the operators defined in parts A through C. E. Write a test program that tests various operations on the class rectangleType. rectangleType.h double area() const; double getLength() const; double getWidth() const; double perimeter() const; void setDimension(double I, double w); friend ostream& operator<<(ostream&, const rectangle Type &); friend istream& operator>>(istream&, rectangle Type &); G:\CIS 23 - Data Structures and Algorithms\2020 Sprg\CIS023-Mockups Spring 2020\CIS 023 - Lab2 Mockups ONLINE.docx
CIS 023 - Lab2 Mockups ONLINE
rectangle Type operator + (const rectangle Type &) const;
rectangle Type operator - (const rectangle Type &) const;
rectangle Type operator* (const rectangle Type&) const;
rectangle Type operator ++ ():
rectangle Type operator ++ (int);
rectangle Type operator -- ():
rectangle Type operator -- (int);
bool operator == (const rectangle Type&) const;
bool operator != (const rectangle Type&) const;
bool operator <= (const rectangleType&) const;
bool operator < (const rectangle Type&) const;
bool operator >= (const rectangleType&) const;
bool operator > (const rectangleType&) const;
rectangle Type();
rectangle Type(double I, double w);
G:\CIS 23 - Data Structures and Algorithms 2020 Sprg\CISO23-Mockups Spring 2020\CIS 023-Lab2 Mockups
ONLINE.docx
Transcribed Image Text:CIS 023 - Lab2 Mockups ONLINE rectangle Type operator + (const rectangle Type &) const; rectangle Type operator - (const rectangle Type &) const; rectangle Type operator* (const rectangle Type&) const; rectangle Type operator ++ (): rectangle Type operator ++ (int); rectangle Type operator -- (): rectangle Type operator -- (int); bool operator == (const rectangle Type&) const; bool operator != (const rectangle Type&) const; bool operator <= (const rectangleType&) const; bool operator < (const rectangle Type&) const; bool operator >= (const rectangleType&) const; bool operator > (const rectangleType&) const; rectangle Type(); rectangle Type(double I, double w); G:\CIS 23 - Data Structures and Algorithms 2020 Sprg\CISO23-Mockups Spring 2020\CIS 023-Lab2 Mockups ONLINE.docx
Expert Solution
Step 1

The solution is given below 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Hey thank you for your answer. 

I would like to know the main C++ modules that I need to know/understand to complete this program myself. i.e (Classes, structures, arrays, strings...)

Please let me know the exact modules so I can study them as soon as possible.

 

Thank you.

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education