Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

PART B:

image text in transcribed

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

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

Would you say Yasmins story is more about change or continuity?

Answered: 1 week ago

Question

3. What are potential solutions?

Answered: 1 week ago