Course Solutions Uncategorized (Solved) : C Use Abstract Class Shape Define Twod Shape Add Functionalities Methods Define Instances Q34451437 . . . .

(Solved) : C Use Abstract Class Shape Define Twod Shape Add Functionalities Methods Define Instances Q34451437 . . . .

 

C++

Use the abstract class shape to define TwoDshape and add all the functionalities to the methods.

Define the instances triangle, square and rectangle in thedriver class to test the functionality of the TwoDclass you have extended from the shape class.

CLARIFICATION:

TwoD is to be inherited from Shape class. And TwoD class methodscan be changed or we can add new methods to differentiate betweenrectangle and a triangle based on the number of sides.

#include

using namespace std;

template

// shape is square

class shape

{

T side;

public: int getSide()

{

return side;

}

bool setSides(T s)

{

if(s > 0)

{

side = s;

return true;

}

else

return false;

}

T getArea()

{

return side*side;

}

T getPerimeter()

{

return side*4;

}

void display()

{

cout<<“Side: “<

cout<<“Area: “<

cout<<“Perimeter: “<

}

};

int main()

{

shape S1;

int num1;

cout<<“Enter side(integer):

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 2 Consider Sum N M 7 16 Pts Write Iterative Algorithm Computing S B 16 Pts Complexity Big Q33390604 . . . .(Solved) : 2 Consider Sum N M 7 16 Pts Write Iterative Algorithm Computing S B 16 Pts Complexity Big Q33390604 . . . .

<p><img alt="2. Consider the sum n m 广+7 (a) (16 pts.) Write an iterative algorithm for computing S" src="https://media.cheggcdn.com/media%2F421%2F421708ea-eb07-4263-bd22-7fe9495888a8%2FphpY3HjME.png" style="height:415px;width:1024px;" aria-describedby="d3f"/><img alt="(b) (16 pts.) What is the complexity (big-O) of