#include #include "cylinder.h" using namespace std; int main ( ) { // height = 1.9, radius = 2.5, x = 3.5, y = 0.1 Cylinder cylinder ( 1.9, 2.5, 3.5, 0.1 ); cout << "Test 1: testing the constructor with get functions..." << endl; cout << "GetX = " << cylinder.getX ( ) << endl; cout << "GetY = " << cylinder.getY ( ) << endl; cout << "GetRadius = " << cylinder.getRadius ( ) << endl; cout << "GetArea = " << cylinder.getArea ( ) << endl; cout << "GetHeight = " << cylinder.getHeight ( ) << endl; cout << "GetVolume = " << cylinder.getVolume ( ) << endl; cout << "------------------------------------------------------------\n"; // Changing the X and Y points cylinder.resetValues ( 5.9, -19.7 ); // Changing the radius cylinder.resetRadius ( 96.5 ); // Changing the height cylinder.resetHeight ( 5.6 ); cout << "Test 2: Testing the reset functions..." << endl; cout << "GetX = " << cylinder.getX ( ) << endl; cout << "GetY = " << cylinder.getY ( ) << endl; cout << "GetRadius = " << cylinder.getRadius ( ) << endl; cout << "GetHeight = " << cylinder.getHeight ( ) << endl; cout << "GetArea = " << cylinder.getArea ( ) << endl; cout << "GetVolume = " << cylinder.getVolume ( ) << endl; cout << "------------------------------------------------------------\n"; // testing operator overloading cout << "Test 3: operator overloading" << endl; cout << cylinder; cout << "------------------------------------------------------------\n"; Point p ( 7, 11 ); Circle cir ( 3.5, 22, 8 ); Cylinder cyl ( 10, 3.3, 10, 10 ); cout << "Test 4: Testing virtual functions" << endl; p.printShapeInfo ( ); cout << endl; cir.printShapeInfo ( ); cout << endl; cyl.printShapeInfo ( ); cout << endl; cout << "------------------------------------------------------------\n"; Shape *ShapeArray[3]; ShapeArray[0] = &p; ShapeArray[1] = ○ ShapeArray[2] = &cyl; cout << "Test 5: Testing virtual functions" << endl; for ( int i = 0; i < 3; i ++ ) { ShapeArray[i]->printShapeInfo ( ); cout << "GetArea = " << ShapeArray[i]->getArea ( ) << endl; cout << "GetVolume = " << ShapeArray[i]->getVolume ( ) << endl; cout << endl; } cout << "------------------------------------------------------------\n"; return 1; }