Question: #include #include using namespace std; class Shape { public: virtual string getType() = 0; virtual double getPerimeter() = 0; virtual double getArea() = 0; };

 #include #include using namespace std; class Shape { public: virtual string

#include #include using namespace std;

class Shape { public: virtual string getType() = 0; virtual double getPerimeter() = 0; virtual double getArea() = 0; };

//Implement class Triangle here

//Implement class Circle here

void describeShape(Shape &s) { double a = s.getArea(); double p = s.getPerimeter(); string t = s.getType();

cout

/** * Determines the larger are between the two Shape objects * The larger area is stored in result */ void largerArea(Shape &a, Shape &b, double *result) { //Complete the function }

int main() { Triangle t; Circle c; c.setDims(2); t.setDims(3, 4, 5);

describeShape(t); describeShape(c);

double result; largerArea(t, c, &result); cout

t.setDims(6, 8, 10); describeShape(t); describeShape(c); largerArea(t, c, &result); cout

return 0; } in c++

Question 2: Download lab12 Q2.cpp. The following function accepts objects by reference and indicates the object that has larger area by storing a value in the variable pointed to by result. Implement the function using the classes defined in Question 1. ak *Determines the larger area between two Shape objects * The larger area is stored in result void largerArea(Shape &a, Shape &b, double 'result); . Use the given driver program to produce the following output: his Triangle has a perimeter of: 12 and an area of: 6 his circle has a perimeter of: 12.5664 and an area of: 12.5664 he larger area is: 12,5664 his Triangle has a perimeter of: 24 and an area of: 24 is Circle has a perimeter of: 12.5664 and an area of: 12.5664 The larger area is: 24 ress any key to continue. Note, largerArea) must not produce terminal output, the value must be passed to the caller through the result pointer variable. Submission

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!