// file: cylinderComposition.cpp
// CylinderComposition class inherits from class CircleComposition.
#include <iostream>  

using std::cout;

#include "cylinderComposition.h"   // CylinderComposition class definition

// default constructor
CylinderComposition::CylinderComposition( double xValue, double yValue, double radiusValue, 
  double heightValue ) 
  : base( xValue, yValue, radiusValue )
{
   setHeight( heightValue );

} // end CylinderComposition constructor

//center member of type Point setter and getter
void CylinderComposition::setX( double xValue){    // set x in coordinate pair
	base.setX(xValue);
}

double CylinderComposition::getX() const{    // return x from coordinate pair
	return base.getX();
}

void CylinderComposition::setY( double yValue){    // set y in coordinate pair
	base.setY(yValue);
}
double CylinderComposition::getY() const{    // return y from coordinate pair
	return base.getY();
}

//base member of type CircleComposition setter and getter
void CylinderComposition::setRadius( double radiusValue){   // set base radius

	base.setRadius(radiusValue);

}
double CylinderComposition::getRadius() const{   // return base radius

	return base.getRadius();

}
double CylinderComposition::getDiameter() const{       // return base diameter
	return base.getDiameter();
}

double CylinderComposition::getCircumference() const{  // return base circumference
	return base.getCircumference();
}
double CylinderComposition::getBaseArea() const{          // return base area
	return base.getArea();
}


// set CylinderComposition's height
void CylinderComposition::setHeight( double heightValue )
{
   height = ( heightValue < 0.0 ? 0.0 : heightValue );

} // end function setHeight

// get CylinderComposition's height
double CylinderComposition::getHeight() const
{
   return height;

} // end function getHeight

// CircleComposition function getArea to calculate CylinderComposition area
double CylinderComposition::getArea() const
{
   return 2 * base.getArea() + 
      base.getCircumference() * getHeight();

} // end function getArea

// calculate CylinderComposition volume
double CylinderComposition::getVolume() const
{
   return base.getArea() * getHeight();

} // end function getVolume

// output CylinderComposition object
void CylinderComposition::print() const
{
   base.print();
   cout << "; Height = " << getHeight();

} // end function print

/* to complement the example from Chapter 9, Deitel & Deitel: C++ How to Program. Fourth edition.
 * Prentice Hall, 2003. 
 */
