Question: C++ PROGRAMMING PART A: PART B: CODE NEEDED: lab12_Q1.cpp: #include #include #include using namespace std; class Shape { public: virtual string getType() = 0; virtual

C++ PROGRAMMING

PART A:

C++ PROGRAMMING PART A: PART B: CODE NEEDED: lab12_Q1.cpp: #include #include #include

PART B:

using namespace std; class Shape { public: virtual string getType() = 0;

CODE NEEDED:

lab12_Q1.cpp:

#include #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  

lab12_Q2.cpp:

#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   Download lab12 Q1 cpp. Triangles, and Circles are Shapes, geometric objects which can have their perimeter and area calculated. Implement a Shape abstract class, which can be used in the following mann void describeShape (Shape double area s.getArea0 string type s get Type0; double perim s.get Perimeter 0 cout "This type has a perimeter of perim and an area o area endl. The Shape class is provided for you. Implement Triangle and Circle classes and use the given driver program to produce the following output This Triangle has a perimeter of 12 and an area of: 6 This Circle has a perimeter of: 25.1328 and an area of: 50.2656 Press any key to continue Please do not modify the driver program. No state pertaining to the Triangle or Circle may be stored in the Shape objects. Use Heron's formula for calculating the area of a Triangle: A Nos (a b c)/2

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!