its not huge. ill post the remaining files
rectangle.cpp:
Code:
#include "Rectangle.h"
Rectangle::Rectangle(double length, double width)
{
length=0.0;
width=0.0;
}
double Rectangle::getWidth()
{
return width;
}
double Rectangle::getLength()
{
return length;
}
double Rectangle::getArea()
{
double area;
area=length*width;
return area;
}
main file ( the part commented out was my first attempt)
Code:
#include "Rectangle.h"
#include "Cube.h"
#include <iostream>
//#include <fstream>
#include <iomanip>
#include <conio.h>
using namespace std;
/*
void main()
{
cout<<"Welcome to the rectangle program which will ask you for a length and a width"<<endl;
cout<<" it will then compute the area "<<endl;
//cout<<"Please enter the length: "<<endl;
//cin>>length; undeclared var.
Rectangle r(4,5);
r.getArea();
cout<<endl<<r.getLength()<<endl;
}//main
*/
void main()
{
int selection=0;
double length=0;
double width=0;
double height=0;
cout<<"Basic Geometric Calculator Program"<<endl;
cout<<"1) Calculate Rectangle Statistics. "<<endl;
cout<<"2) Calculate Cube Statistics."<<endl;
while (selection != 1 || 2 )
{
cout<<"Please enter the number for the function you wish to execute. "<<endl;
cout<<"Function #: ";
cin>>selection;
if (selection==1)
{
cout<<"\nPlease enter the lenght of the rectangle: ";
cin>>length;
cout<<"\nPlease enter the width of the rectangle: ";
cin>>width;
Rectangle r(length,width);
cout<<"\n\nRectangle Statistics: "<<endl;
cout<<"\nLength: "<<r.getLength();
cout<<"\nWidth: "<<r.getWidth();
cout<<"\nArea: "<<r.getArea();
}
else if (selection==2)
{
cout<<"\nPlease enter the side length of the cube: ";
cin>>height;
Cube c(height);
cout<<"\n\nCube Statistics: "<<endl;
cout<<"\nLength: "<<c.getHeight();
cout<<"\nWidth: "<<c.getHeight();
cout<<"\nHeight: "<<c.getHeight();
cout<<"\nVolume: "<<c.getVolume();
}
else
cout<<"\nInvalid Selection. Please re-enter selection."<<endl;
}
}//main