CHAPTER 10 Object-Oriented C++ method to calculate and return the area of the rectangle and the perimeter of the Write a public calculateArea() method and a public calculatePerimeter(). 6. Save this class file, Rectangle.cpp, in a directory of your choice, and then open the rectangle. a file named MyRectangleClassProgram.cpp. 7. In the MyRectangleClassProgram, create two Rectangle objects named rectanglel and rectangle2 using the default constructor as you saw in MyEmployeeClassProgram.cpp. 8. Set the length of rectanglel to 10.0 and the width to 5.0. Set the length of Print the value of rectangle1's perimeter and area, and then print the value of rectangle2 to 7.0 and the width to 3.0. rectangle2's perimeter and area. L con in the same directory as Rectangle.com

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

// Rectanlge.cppusing namespace std;class Rectangle{ public: // Declare public methods here private: // Create length and width here}; void Rectangle::setLength(double len){ // Write setLength here}void Rectangle::setWidth(double wid){ // write setWidth here}double Rectangle::getLength(){ // write getLength here}double Rectangle::getWidth(){ // write getWidth here}double Rectangle::calculateArea(){ // write calculateArea here}double Rectangle::calculatePerimeter(){ // write calculatePerimeter here}

 

 

// This program uses the programmer-defined Rectangle class. #include "Rectangle.cpp"#include <iostream>using namespace std; int main(){ // Create Rectangle objects here // Set the lengths and widths here // Print the areas and perimeters here return 0;}

the Circle class that you worked with in Exercise 10-1 as a guide.
The program should create two Rectangle objects and find their area and perimeter. Use
In this lab, you create a programmer-defined class and then use it in a C++ program.
1. Open the class file named Rectangle.cpp using Notepad or the text editor of your
th 10-1: Creating a Class in C++
you
In this lab,
a
ecire a dlass file named Rectangle.cpp using Notepad or the text editor of your
choice.
In the Rectangle class, create two private attributes named length and width. Both
length and width should be data type double.
2 Write public set methods to set the values for length and width.
4. Write public get methods to retrieve the values for length and width.
Transcribed Image Text:the Circle class that you worked with in Exercise 10-1 as a guide. The program should create two Rectangle objects and find their area and perimeter. Use In this lab, you create a programmer-defined class and then use it in a C++ program. 1. Open the class file named Rectangle.cpp using Notepad or the text editor of your th 10-1: Creating a Class in C++ you In this lab, a ecire a dlass file named Rectangle.cpp using Notepad or the text editor of your choice. In the Rectangle class, create two private attributes named length and width. Both length and width should be data type double. 2 Write public set methods to set the values for length and width. 4. Write public get methods to retrieve the values for length and width.
CHAPTER 10
Object-Oriented C++
5.
choice, and then
of your
open
directory
the
rectangle.
184
le named MyRectangleClassProgram.cpp.
* in the MyRectangleClassProgram, create two Rectang le objects named
MyEmployeeClassProgram.cpp.
rectangle2 to 7.0 and the width to 3.0.
9.
rectangle2's perimeter and area.
10. Save MyRectangleClassProgram.cpp in the same directory as Rectangle a
11. Compile the source code file MyRectangleClassProgram. cpp.
12. Execute the program.
13. Record the output below.
Reusing C++ Classes
Transcribed Image Text:CHAPTER 10 Object-Oriented C++ 5. choice, and then of your open directory the rectangle. 184 le named MyRectangleClassProgram.cpp. * in the MyRectangleClassProgram, create two Rectang le objects named MyEmployeeClassProgram.cpp. rectangle2 to 7.0 and the width to 3.0. 9. rectangle2's perimeter and area. 10. Save MyRectangleClassProgram.cpp in the same directory as Rectangle a 11. Compile the source code file MyRectangleClassProgram. cpp. 12. Execute the program. 13. Record the output below. Reusing C++ Classes
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Program on Numbers
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