Every cylinder has a base and height, where the base is a circle

Every cylinder has a base and height, where the base is a circle. Design the class Cylinder that can capture the properties of a cylinder and perform the usual operations on a cylinder. Derive this class from the class Circle (done through Problem 3.2). do the following: Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base, and set the center of the base. Write a test program to test your program. Note: Java programming. also send the test program so I can run it in dr java and learn. Circle code: public class Circle { //declaring data members protected double radius; protected Point center; //constructor public Circle() { radius=0; center=new Point(); } //parameterized constructor public Circle(Point p, double radius) { center=p; this.radius=radius; } //getters and setters for radius public double getRadius() { return radius; } public void setRadius(double radius) { this.radius=radius; } //getters and setters for center public void setCenter(Point p) { center=p; } public Point getPoint() { return center; } //finding area public double getArea() { return 3.14*radius*radius; } //finding circumference public double getCircumference() { return 2*3.14*radius; } }

-25-


Buy plagiarism free, original and professional custom paper online now at a cheaper price. Submit your order proudly with us



Essay Hope