Creating a program with a circle class that has 3 private variables and 3 public functions and then have accessor & mutator functions.
I know this isn't right, but I've gone through the book and my notes and I feel like I've mixed up a few ways of doing it and combined it together...just need a little guidance from where I'm at now.
This is what I have so far.
#include <iostream>
using namespace std;
const float PI = 3.14;
class Circle
{
public:
void setRadius(double newRadius);
double getRadius();
double CalculateArea();
double CalculateCircumference();
void DisplayOutPut();
private:
double radius;
double circumference;
double area;
};
int main()
{
Circle myCircle;
myCircle.setRadius(12);
myCircle.CalculateArea;
myCircle.CalculateCircumference;
myCircle.DisplayOutPut;
}
double Circle::getRadius()
{
return radius;
}
double Circle::CalculateArea()
{
area = (PI*(radius*radius));
}
double Circle::CalculateCircumference()
{
circumference = (2*radius*PI);
}
void Circle::DisplayOutPut();
{
cout << "Radius: " << radius << endl;
cout << "Circumference: " << circumference << endl;
cout << "Area: " << area << endl;
}