Write public set methods to set values for length and width

Assignment Help Basic Computer Science
Reference no: EM131397395

CREATING A CLASS IN C++ In this lab, you create a programmer-defined class and then use it in a C++ program. The program should create two Rectangle objects and find their area and perimeter. Use the Circle class that you worked with in Exercise 10-1 as a guide.

1. Open the class file named Rectangle.cpp using Notepad or the text editor of your choice.

2. In the Rectangle class, create two private attributes named length and width. Both length and width should be data type double.

3. 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.

5. Write a public calculateArea()method and a public calculatePerimeter() method to calculate and return the area of the rectangle and the perimeter of the rectangle.

6. Save this class file, Rectangle.cpp, in a directory of your choice and then open the file named MyRectangleClassProgram.cpp.

7. In the MyRectangleClassProgram, create two Rectangle objects named rectangleOne and rectangleTwo using the default constructor as you saw in MyEmployeeClassProgram.cpp.

8. Set the length of rectangleOne to 4.0 and the width to 6.0. Set the length of rectangleTwo to 9.0 and the width to 7.0.

9. Print the value of rectangleOne's perimeter and area, and then print the value of rectangleTwo's perimeter and area.

10. Save MyRectangleClassProgram.cpp in the same directory as Rectangle.cpp.

11. Compile the source code file MyRectangleClassProgram.cpp.

12. Execute the program.

13. Record the output below

Reference no: EM131397395

Questions Cloud

Perform the paired t test for means : For the data in Table, perform the paired T test for means using the weights for the east and south sides of the trees. Verify that the p-value is 0.09.
Future human resources needs of an organization : When an HR Department is planning for the future Human Resources needs of an organization, it is also involved in an Internal Assessment of its current workforce. What is the purpose of this activity – Describe briefly
Managing human resources : The aim of this assignment is to assess understanding of the theory and practice of human resource management focussing on current human resources practice and the impact of topical issues and legislation.
Vectors in an n-dimensional vector space : Let {x1,x2,...,xn} be any set of n vectors in an n-dimensional vector space V. Prove that V=span{x1,x2,...,xn} if and only if {x1,x2,...,xn} is linearly independent.
Write public set methods to set values for length and width : Write a public calculateArea()method and a public calculatePerimeter() method to calculate and return the area of the rectangle and the perimeter of the rectangle.
Current evidence and implications for future research : NURS 141: Article is Evidence Based, peer reviewed, published
More full-time employee to meet additional demand : Dave's Stove-Top Popcorn currently has three full-time employees who are each paid $1,300 per month. An employee can only work a maximum of 100 hours per month because production normally takes place at night. Develop a production plan if Dave relies..
System of two equations in two variables : Express the situation as a system of two equations in two variables. Be sure to state clearly the meaning of yourx- andy-variables. Solve the system by row-reducing the corresponding augmented matrix. State your final answer in terms of the origin..
Perform the paired t test for means using the weights : For the data in given Table, perform the paired T test for means using the weights for the east and south sides of the trees. Verify that the p-value is 0.09.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd