Wednesday, March 7, 2007

Making a class

//In this program I decided to just get a little more familiar with making a class
// It really does nothing but sets up a class for reinforcement



#include "box.h"
#ifndef _BOX
#define _BOX

using namespace std;


box::box()
{
height = width = depth = 1;
}

box::box(double a, double b, double c)
{
if(a > 0 && b > 0 && c > 0)
{
height = a;
width = b;
depth = c;
}
}

string box::setName()
{
return name;
}

void box::setHeight(double a)
{
if(a > 0)
{
height = a;
}
}

void box::setWidth(double a)
{
if(a > 0)
{
width = a;
}
}

void box::setDepth(double a)
{
if(a > 0)
{
depth = a;
}
}

double box::area()
{
double area;
area = (2 * (box().height * box().width)) +
(2 * (box().height * box().depth)) +
(2 * (box().width * box().depth));

return area;
}

double box::volume()
{
double volume;
volume = (box().height * box().width * box().depth);

return volume;
}

//void boxAtt()
//{
// name
// height
// width
// depth
//}

string box::getName()
{
return name;
}

double box::getHeight(double height)
{
return height;
}

double box::getWidth(double width)
{
return width;
}

double box::getDepth(double depth)
{
return depth;
}


#endif