Write three classes named point circle and cylinder each


Assignment: Points, Circles, and Cylinders Requirements

Your task is to write three classes named Point, Circle, and Cylinder. Each should have a .h and a .cpp file. Point is the base class. Circle inherits from Point. Cylinder inherits from Circle. Each class needs a constructor and an overloaded insertion operator (<<).

The following main.cpp file:

#include
#include "point.h"
#include "circle.h"
#include "cylinder.h"

using namespace std;

int main()
{
Point p(4,4); // x coordinate, y coordinate
Circle c(5,5,5); // x, y, radius
Cylinder y (6, 6, 6, 6); // x, y, r, height

cout << p << endl << endl;
cout << c << " " << endl << (Point) c << endl << endl;
cout << y << " " << endl << (Circle) y << " " << endl << (Point) y
<< endl << endl;

return 0;
}

produces this output:

Point at (4, 4)

Circle with center = (5, 5); Radius = 5; Area = 78.5397
Point at (5, 5)

Cylinder with center = (6, 6); Radius = 6; Height = 6; Volume = 678.583
Circle with center = (6, 6); Radius = 6; Area = 113.097
Point at (6, 6)

Submit 6 files (point.h, point.cpp, circle.h, circle.cpp, cylinder.h, and cylinder.cpp) combined as a single zip file. The graders will compile your source along with their main.cpp to test program functionality.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write three classes named point circle and cylinder each
Reference No:- TGS02714033

Now Priced at $45 (50% Discount)

Recommended (91%)

Rated (4.3/5)