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

  Given a digraph a vertex-indexed array of positive weights

Given a digraph, a vertex-indexed array of positive weights, and a start vertex v, find the paths from v to each other vertex such that the sum of the weights of the vertices on the path is minimized.

  Centralized or decentralized account

Is an account created in Window 7 VM a centralized or decentralized account. If you wanted to log onto a second computer using the same username and password, what would you need to do first?

  Problem regarding the dynamic programming

Dynamic Programming ( 0-1 Knapsack Problem) Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack.

  Critical issues related to it governance-determine

Read the scenario below and identify the critical issues related to IT Governance and determine how you would resolve the issues. Write a 3 page paper that addresses the following issues:

  What is the probability of getting 5 or 6 on a single throw

What is the probability of getting a number less than 5 on a single throw?

  Make use of subprograms and functions

Using Notepad, write a program using Pseudocode to solve the following problem. In your program, make use of subprograms and functions with parameters and arguments.

  No effect on the accuracy of confidence intervals

are in addition to the random variation accounted for by the announced margin of error.

  Incorporate this method into an application

Incorporate this method into an application that inputs a series of pairs of integers (one pair at a time) and determines whether the second value in each pair is a multiple of the first

  How many hours does he have to work

Dave works at the mall part-time for $9 per hour and notices that 20% of his check is deducted for taxes. If he wants to take home at least $200 per week, how many hours does he have to work?

  Managing files and the world of windows

Managing Files and the World of Windows. Take a position on whether or not standardization and naming conventions are critical for properly managing files and folders in a Windows environment.

  Why do the results in parts c and e seem contradictory

Why do the results in parts c and e seem contradictory? If we want to see if there is a gender gap among voters with respect to this candidate, which is the correct approach? Why?

  Continuing the design of solution for ecpi emr

You are continuing the design of your solution for ECPI EMR. Use Microsoft Word (via XenDesktop if necessary). ECPI EMR has one central IT infrastructure office, with components of the Active Directory distributed through four other locations. Cond..

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