Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago