//
//  The member functions for the class hierarchy defined in
//  figure.h. 
//


#include <iostream>
#include "figure.h"

const float PI = 3.14159265f;


void
Figure::Output_Info( )
{
	std::cout << "Base figure object:  nothing to output" << std::endl;
}


///////////////////////////////////////////////////////
/////////   "Rectangle" Member Functions   ////////////
///////////////////////////////////////////////////////

Rectangle::Rectangle( float height_in, float width_in ) 
{
	height = height_in;
	width = width_in;
}

float 
Rectangle::Area( )
{
	return height*width;
}

void
Rectangle::Output_Info( )
{
	std::cout << "Rectangle:   height " << height
				<< "  width " << width << std::endl;
}


////////////////////////////////////////////////////
/////////   "Square" Member Functions   ////////////
////////////////////////////////////////////////////

Square::Square( float side ) : Rectangle( side, side )
{
}

void
Square::Output_Info( )
{
	std::cout << "Square:  side " << width << std::endl;
}


///////////////////////////////////////////////////////
///////////   "Circle" Member Functions   /////////////
///////////////////////////////////////////////////////

Circle::Circle( float radius_in ) 
{
	radius = radius_in;
}

float 
Circle::Area( )
{
	return PI * radius * radius;
}

void
Circle::Output_Info( )
{
	std::cout << "Circle:   radius " << radius << std::endl;
}


///////////////////////////////////////////////////////
///////////   "Sphere" Member Functions   /////////////
///////////////////////////////////////////////////////

Sphere::Sphere( float radius_in ) : radius(radius_in)
{ } 

float 
Sphere::Area( )
{
	return 4 * PI * radius * radius;
}

float 
Sphere::Volume( )
{
	return 4.0 / 3.0 * PI * radius * radius * radius;
}

void
Sphere::Output_Info( )
{
	std::cout << "Sphere:   radius " << radius << std::endl;
}

  
