Create a class Point with two data members x and y. Provide appropriate constructors, get, set and
Question:
Create a class Point with two data members x and y. Provide appropriate constructors, get, set and display methods.
Derive a class Circle from Point. The circle, in addition to the center (Point) also has radius as its data member. Provide constructors, get and set methods in the circle class. Also provide methods to compute area and circumference of the circle. (Area of circle is PI * r * r and Circumference is: 2 * PI * r).
Derive a class Cylinder from circle with a data member height. Provide constructors and set /get methods to set /get height of the cylinder. Provide a function to compute area of cylinder. (A = 2 x are of circle (base) + 2*PI* r*height). Also provide a function to compute the volume of cylinder (PI * r*r*h).
Derive a class sphere from circle. Provide a function to compute volume of sphere area of volume of sphere is. (A = 4/3 x PI *r*r*r).
Create an object of class Cylinder and compute its volume and surface area.
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang