Skip to main content

circle.cpp


// Solution to Exercise 27
// (NDE, 2014-02-13)
#include <cmath>
#include "circle.hpp"
Circle::Circle(double x, double y, double r)
{
  centre_x = x;
  centre_y = y;
  radius = r;
}
double Circle::get_x()
{
  return centre_x;
}
double Circle::get_y()
{
  return centre_y;
}
double Circle::get_radius()
{
  return radius;
}
double Circle::area()
{
  return M_PI*radius*radius;
}
double Circle::circumference()
{
  return 2*M_PI*radius;
}