edo Programming Exercise 3 by overloading the operators as nonmembers of the class boxType. Write a test program that tests various operations on the class boxType. Reference:   Chapter 11 defined the class boxType by extending the definition of the class rectangleType. In this exercise, derive the class boxType from the class rectangleType, defined in Exercise 1, add the functions to overload the operators +,–, *, ==, !=, <=, <, >=, >, and pre- and post-increment and decrement operators as members of the class boxType. Also overload the operators << and >>. Overload the relational operators by considering the volume of the boxes. For example, two boxes are the same if they have the same volume. Write the definitions of the functions of the class boxTyp

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

Redo Programming Exercise 3 by overloading the operators as nonmembers of the class boxType.

Write a test program that tests various operations on the class boxType.

Reference:
 

Chapter 11 defined the class boxType by extending the definition of the class rectangleType. In this exercise, derive the class boxType from the class rectangleType, defined in Exercise 1, add the functions to overload the operators +,–, *, ==, !=, <=, <, >=, >, and pre- and post-increment and decrement operators as members of the class boxType. Also overload the operators << and >>. Overload the relational operators by considering the volume of the boxes. For example, two boxes are the same if they have the same volume.

Write the definitions of the functions of the class boxType as defined above and then write a test program that tests various operations on the class.

Tasks
boxType.c.
boxType.h main.cpp
rectangleT. rectangle T.
1 #ifndef H_rectangleType
Overloaded operators as
2 #define H_rectangleType
non-member functions
3
0.00
out of
10.00
4 #include <iostream>
5 using namespace std;
O out of 7 checks passed.
7 class rectangleType
Review the results below
8 {
for more details.
//Overload the stream insertion and extrac
operators
Checks
10
friend ostre am& operator<<(ostream&, const rec
Code Pattern
Incomplete
11
friend istream& operator>>(istream&, rectangle
Overloading the + operator
12
13 public:
14
void setDimension (double 1, double w);
double getLength() const;
double getWidth() const;
double area() const;
double perimeter() const;
Code Pattern
Incomplete
>
Overloading the - operator
15
16
Code Pattern • Incomplete
<>
17
Overloading ++ operator
18
Transcribed Image Text:Tasks boxType.c. boxType.h main.cpp rectangleT. rectangle T. 1 #ifndef H_rectangleType Overloaded operators as 2 #define H_rectangleType non-member functions 3 0.00 out of 10.00 4 #include <iostream> 5 using namespace std; O out of 7 checks passed. 7 class rectangleType Review the results below 8 { for more details. //Overload the stream insertion and extrac operators Checks 10 friend ostre am& operator<<(ostream&, const rec Code Pattern Incomplete 11 friend istream& operator>>(istream&, rectangle Overloading the + operator 12 13 public: 14 void setDimension (double 1, double w); double getLength() const; double getWidth() const; double area() const; double perimeter() const; Code Pattern Incomplete > Overloading the - operator 15 16 Code Pattern • Incomplete <> 17 Overloading ++ operator 18
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps with 8 images

Blurred answer
Knowledge Booster
Data members
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