Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 5 - Task 1 - ITEC 243 Create a rectangle class with the private properties (data members) listed below:- length, width, and the procedures

image text in transcribed

Lab 5 - Task 1 - ITEC 243 Create a "rectangle" class with the private properties (data members) listed below:- length, width, and the procedures listed below: (In the member functions, use this pointer.) A function Object() { [native code] } method that prompts (asks) the user for data member values to be entered. - A function Object() { [native code] } that takes the two data member values as input. The method rect areal) calculates the rectangle's area and returns it to the main function for processing. (Hint: area equals length times breadth.) The method rect perimeter() calculates the rectangle's circumference and returns it to the main function for processing. (Hint: perimeter equals 2*length+width) The main function will pass the rectangle's updated length and width to the setrect dim() method. A method show() that displays the rectangle's current length and width. -A destructor method that displays the objects that have been removed. Save the "rect.h" header file with the above class definition. Create a separate C++ programme (rect.cpp) to perform the following tasks:. Create a pointer object called "rptri" to point a rectangle object WrectPtr1". Create a rectangle object rectPtr2 with length=3 and width=7.. Display the area of rptri. Display the perimeter of rptri. Display the length and width of rptri. Display the area of rptr2 . Display the perimeter of rptr2. Display the length and width of rptr2. Change the length and width of rptr2. Show the perimeter of rptri. Show the area of rptri. Create an array object called "rectPtr3" for four rectangles. Create a pointer object called "recrArrPtr" to point at the "rectPtr3" array object. Display the area and perimeter of array objects. Calculate the average area and perimeter of array objects and display them. Desired Result: Enter the following values for length and width: 10 20 Length - 10 Width - 20 The first object's area is 200 square metres, and its perimeter is 200 metres. 68 Width = 3 Length =? Second object's surface area 21 Second object's perimeter 20 inches long x 8 inches wide x 5 inches high The first object's new area is 48. First object's new perineter 26 width: 12 15 width: 12 15 width: 12 15 width: 12 15 width: 12 15 width Enter the following values for length and width: 15 20 Enter the following values for length and width: 20 25 Enter the following values for length and width: 20 30 The area of 1. object is 180 square metres, while the perimeter of i. object is 54 square metres. Area of the second object 300 580 Perineter of 3. object 90 Area of 4. object 600 Perineter of 2. object 70 Area of 3. object 580 Perineter of 3. object 90 Area of 4. object 500 object 100 has a perimeter of four. 395 square feet on average The average perimeter is 78 feet. To continue, press any key: The rectangle object with the values 29 and 38 has been removed. The rectangle object with values of 20 and 25 has been removed. The rectangle object with the values 15 and 20 has been removed. The rectangle object with values of 12 and 15 has been removed. The rectangle object with the values 3 and 7 has been removed. The rectangle object with the values of 8 and 5 was removed... To continue, press any key. Lab 5 - Task 1 - ITEC 243 Create a "rectangle" class with the private properties (data members) listed below:- length, width, and the procedures listed below: (In the member functions, use this pointer.) A function Object() { [native code] } method that prompts (asks) the user for data member values to be entered. - A function Object() { [native code] } that takes the two data member values as input. The method rect areal) calculates the rectangle's area and returns it to the main function for processing. (Hint: area equals length times breadth.) The method rect perimeter() calculates the rectangle's circumference and returns it to the main function for processing. (Hint: perimeter equals 2*length+width) The main function will pass the rectangle's updated length and width to the setrect dim() method. A method show() that displays the rectangle's current length and width. -A destructor method that displays the objects that have been removed. Save the "rect.h" header file with the above class definition. Create a separate C++ programme (rect.cpp) to perform the following tasks:. Create a pointer object called "rptri" to point a rectangle object WrectPtr1". Create a rectangle object rectPtr2 with length=3 and width=7.. Display the area of rptri. Display the perimeter of rptri. Display the length and width of rptri. Display the area of rptr2 . Display the perimeter of rptr2. Display the length and width of rptr2. Change the length and width of rptr2. Show the perimeter of rptri. Show the area of rptri. Create an array object called "rectPtr3" for four rectangles. Create a pointer object called "recrArrPtr" to point at the "rectPtr3" array object. Display the area and perimeter of array objects. Calculate the average area and perimeter of array objects and display them. Desired Result: Enter the following values for length and width: 10 20 Length - 10 Width - 20 The first object's area is 200 square metres, and its perimeter is 200 metres. 68 Width = 3 Length =? Second object's surface area 21 Second object's perimeter 20 inches long x 8 inches wide x 5 inches high The first object's new area is 48. First object's new perineter 26 width: 12 15 width: 12 15 width: 12 15 width: 12 15 width: 12 15 width Enter the following values for length and width: 15 20 Enter the following values for length and width: 20 25 Enter the following values for length and width: 20 30 The area of 1. object is 180 square metres, while the perimeter of i. object is 54 square metres. Area of the second object 300 580 Perineter of 3. object 90 Area of 4. object 600 Perineter of 2. object 70 Area of 3. object 580 Perineter of 3. object 90 Area of 4. object 500 object 100 has a perimeter of four. 395 square feet on average The average perimeter is 78 feet. To continue, press any key: The rectangle object with the values 29 and 38 has been removed. The rectangle object with values of 20 and 25 has been removed. The rectangle object with the values 15 and 20 has been removed. The rectangle object with values of 12 and 15 has been removed. The rectangle object with the values 3 and 7 has been removed. The rectangle object with the values of 8 and 5 was removed... To continue, press any key

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago