
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:1 // Rectangle.cpp
2 using namespace std;
3 class Rectangle
ummary
i this lab, you create a programmer-defined class and then use it in a C++
public:
// Declare public methods here
dpib;e|
private:
// Create length and width here
double length;
double width;
rogram. The program should create two Rectangle objects and find their
rea and perimeter.
8
istructions
10
11
1. Ensure the class file named Rectangle.cpp is open in your editor.
12 };
13
2. In the Rectangle class, create two private attributes named length
14 void Rectangle::setLength(double len)
15 {
and width . Both length and width should be data type double.
16
3. Write public set methods to set the values for length and width.
17 }
18
4. Write public get methods to retrieve the values for length and
19 void Rectangle::setWidth(double wid)
20 {
width.
5. Write a public calculateArea() method and a public
// write setWidth here
21
22 }
calculatePerimeter() method to calculate and return the area of
23
the rectangle and the perimeter of the rectangle.
24 double Rectangle::getLength()
25 {
6. Open the file named MyRectangleClassProgram.cpp.
26
// write getLength here
7. In the MyRectangleClassProgram, create two Rectangle objects named
27 }
28
rectanglel and rectangle2 using the default constructor as you
29 double Rectangle::getWidth()
30 {
saw in MyEmployeeClassProgram.cpp.
31
// write getWidth here
8. Set the length of rectanglel to 10.0 and the width to 5.0. Set the
32 }
length of rectangle2 to 7.0 and the width to 3.0.
33
34 double Rectangle::calculateArea()
35 {
9. Print the value of rectanglel's perimeter and area, and then print
the value of rectangle2's perimeter and area.
36
// write calculateArea here
37 }
O. Execute the program by clicking the Run button at the bottom of the
38
39 double Rectangle::calculatePerimeter()
40 {
screen
41
// write calculatePerimeter here
42 }

Transcribed Image Text:MyRectangleClassPro.. Rectangle.cpp
+
1 // This program uses the programmer-defined Rectangle class.
2 #include "Rectangle.cpp"
3 #include <iostream>
4 using namespace std;
5 int main()
6 {
7
Rectangle rectanglel;
Rectangle rectangle2;
8
rectanglel.setLength(10.0);
rectanglel.setWidth(5.0);
rectangle2.setLength(7.0);
rectangle2.setWidth(3.0);
2
3
4
6
cout <« "Perimeter of rectanglel is " « rectanglel.calculatePerimeter() « endl;
cout <« "Area of rectanglel is " <« rectanglel.calculateArea() « endl;
cout <« "Perimeter of rectangle2 is " « rectangle2.calculatePerimeter() <« endl;
cout <« "Area of rectangle2 is " <« rectangle2.calculateArea() <« endl;
8
1
2
3 }
:4
return Ø;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
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
- C++ language pleasearrow_forward11:02 all 10% + Create 1 1000.01 Create 2 2000.02 Create 3 3000.03 Deposit 111.11 Deposit 2 22.22 Withdraw 4 5000.00 Create 4 4000.04 Withdraw 1 0.10 Balance 2 Withdraw 2 0.20 Deposit 3 33.33 Withdraw 4 0.40 Bad Command 65 Balance 1 Balance 2 Balance 3 Balance 4arrow_forwardOpengl Help Programming Language: c++ I need help setting coordinate boundries for this program so the shape can't leave the Opengl window. The shape needs to stay visiable.arrow_forward
- Sultan Qaboos University Department of Computer Science COMP2202: Fundamentals of Object Oriented Programming Assignment # 2 (Due 5 November 2022 @23:59) The purpose of this assignment is to practice with java classes and objects, and arrays. Create a NetBeans/IntelliJ project named HW2_YourId to develop a java program as explained below. Important: Apply good programming practices: 1- Provide comments in your code. 2- Provide a program design 3- Use meaningful variables and constant names. 4- Include your name, university id and section number as a comment at the beginning of your code. 5- Submit to Moodle the compressed file of your entire project (HW1_YourId). 1. Introduction: In crowded cities, it's very crucial to provide enough parking spaces for vehicles. These are usually multistory buildings where each floor is divided into rows and columns. Drivers can park their cars in exchange for some fees. A single floor can be modeled as a two-dimensional array of rows and columns. A…arrow_forwardI need help with this PLEASE NO JAVA NO C++ ONLY PYTHON PLZ Create a class object with the following attributes and actions: Class Name Class number Classroom Semester Level Subject Actions: Store a class list Print the class list as follows: Class name Class Number Semester Level Subject Test your object: Ask the user for all the information and to enter at least 3 classes test using all the actions of the object print using the to string action Describe the numbers and text you print. Do not just print numbers or strings to the screen explain what each number represents.arrow_forwardclass implementation file -- Rectangle.cpp class Rectangle { #include #include "Rectangle.h" using namespace std; private: double width; double length; public: void setWidth (double); void setLength (double) ; double getWidth() const; double getLength() const; double getArea () const; } ; // set the width of the rectangle void Rectangle::setWidth (double w) { width = w; } // set the length of the rectangle void Rectangle::setLength (double l) { length l; //get the width of the rectangle double Rectangle::getWidth() const { return width; // more member functions herearrow_forward
- structions: Write the following programs in C# using concepts learnt in this chapter and abmit the .cs file with the screenshot of your output for each question in the Lab Assignment 2 Submission page. 1. FRENCH TRANSLATOR Look at the following list of French words and their meanings: In French: gauche milieu droite middle In English: right left Create an application that translates the French words to English. The form should have three buttons, one for each French word. When the user clicks a button, the application should display the English translation in a Label control.arrow_forwardC++ code. Please describe what EACH line means/does. Ignore code that is commented out.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Expert Answers to Latest Homework Questions
Q: During the month, Parkview Corporation earned $18,500 in revenue, but only $16,200 of that had been…
Q: I am searching for the correct answer to this general accounting problem with proper accounting…
Q: Praxis Inc. received $14,000 cash from the sale of equipment that had a $19,500 book value. If the…
Q: Northstar Enterprises has revenue of$843,000, cost of goods sold of $356,000, operating expenses of…
Q: I need help with this general accounting problem using proper accounting guidelines.
Q: Please provide the accurate answer to this financial accounting problem using valid techniques.
Q: Calculate accounts receivable turnover
Q: Can you help me solve this general accounting question using valid accounting techniques?
Q: Atlas Components has budgeted sales for January, February, and March of 21,000, 24,500, and 22,000…
Q: Ingram Production creates 4,500 units. Each unit was expected to require 2.2 labor hours at a cost…
Q: Atlas Components has budgeted sales for January, February, and March of 21,000, 24,500, and 22,000…
Q: I am looking for the correct answer to this general accounting question with appropriate…
Q: What is the expected level of operating profits?
Q: Northstar Enterprises has revenue of$843,000, cost of goods sold of $356,000, operating expenses of…
Q: I need guidance with this general accounting problem using the right accounting principles.
Q: What is the total number of equipment whole unit produced
Q: I am looking for the most effective method for solving this financial accounting problem.
Q: Can you provide the valid approach to solving this financial accounting question with suitable…
Q: I am searching for the correct answer to this general accounting problem with proper accounting…
Q: Frederick Company plans to borrow $850,000 from the Riverdale Community Bank by signing a 4.8%,…
Q: I need help with this financial accounting question using the proper financial approach.