Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ref: H. M. Deitel and P.J. Deitel, C++ How to Program, ninth edition, Prentice H

ID: 3694269 • Letter: R

Question

Ref: H. M. Deitel and P.J. Deitel, C++ How to Program, ninth edition, Prentice Hall (Pearson), 2013

C++ Program

1. Define an abstract base class called BasicShape. The BasicShape class should have the following members: (Reference: Fig 12.9 and 12.10 Protected Member Variable: area (a double used to hold the shape's area) a) b) Private Member Variable: name (a string to indicate the shape's type) c) Constructor and Public Member Functions: » BasicShape(double a, string n): A constructor that sets value of member area » calcArea): This public function should » print): A pubic virtual function that * getName): A pubic function that returns with a and member name with n be a pure virtual function prints the value of data member area the value of data member nme

Explanation / Answer

Here is the abstract class BasichShape for you:

#include <iostream>
using namespace std;
class BasicShape
{
protected:
double area;
private:
string name;
public:
BasicShape(double a, string n)
{
area = a;
name = n;
}
virtual void calcArea() = 0;
virtual void print()
{
cout<<"Area: "<<area<<endl;
}
string getName()
{
return name;
}
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote