Question: Implement a new form of the following program replacing all variable type string for variablestype pointer #include using namespace std; class Circle { private: double

Implement a new form of the following program replacing all variable type string for variablestype pointer

#include

using namespace std;

class Circle

{

private:

double radius;

double pi;

public:

Circle();

Circle(double r);

~Circle();

void setRadius(double);

double getRadius();

double getDiameter();

double getArea();

double getPerimeter();

void display();

};

Circle::Circle() {

radius = 0;

}

Circle::Circle(double r) {

radius = r;

}

Circle::~Circle() {

}

void Circle::setRadius(double r) {

radius = r;

}

double Circle::getRadius() {

return radius;

}

double Circle::getDiameter() {

return 2 * radius;

}

double Circle::getArea() {

return pi * radius * radius;

}

double Circle::getPerimeter() {

return 2 * pi * radius;

}

void Circle::display() {

cout << "Radius: " << getRadius() << endl;

cout << "Diameter: " << getDiameter() << endl;

cout << "Perimeter: " << getPerimeter() << endl;

cout << "Area: " << getArea() << endl;

}

int main() {

Circle c(15);

c.display();

0;

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!