Question: Using c++ class RECTANGLE private: float Length, Width; public: RECTANGLE ( // constructor to read the values of Length and Width // compute and return
class RECTANGLE private: float Length, Width; public: RECTANGLE ( // constructor to read the values of Length and Width // compute and return area void computeArea( float& area) void computePerimeterl floar& perimeter); //compute and return perimeter void displayAreaPer(float area, float perimeter): //display area and perimeter RECTANGLEO 0 class TRIANGLE private: float sideA, sideB, sidC; public: TRIANGLE( float SA, float sB, float sC) /initialize sideA,sideB,sideC //compute and return perimeter float computePerimeter) float computeArea( float perimeter); I/use the perimeter to calculate area void displayAreaPer(float area, perimeter); TRIANGLEO 0 class TRAPEZOID private: float lowerBase, upperBase, height; float leftSise, rightSide; public: void readData(): void computeAreaPer (float& area, float& per ): void displayAreaPer[float area, float per); Write a program to use the above declarations and create the following VO. All class members must be defined after both classes Sample I/O Enter the values of width and length of a rectangle: 7.09 12.22 Areaz xx.xx Perimeter xx.xx Enter the values of all three of a triangle: 10.75 6.33 8.11 Area xx.xx Perimeter xx.xx Enter the lowerBase, upperBase, and Height: 18.93 9.33 5.60 Enter the values of left and right sides: 7.12 6.45 Areazxx.xx Preimetere xoX.xx or triangle with sides a, b, and c e(a+b+c)/2 Area:/p(p-a)(p-b)(p-c) a For trapezoid b Area-(a-b)h/2 Perimeter- (a+dic+b
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
