Question: ( Java ) Object Oriented Programming 1. Design and implement the class Circle that contains the double private data field radius and the following member
( Java ) Object Oriented Programming
1. Design and implement the class Circle that contains the double private data field radius and the following member methods:
2. getRadius that returns the radius of Circle object.
3. setRadius that sets the radius of Circle object.
4. area that calculates and return the area of a Circle object (area = *r).
5. toString that returns the radius of a Circle object as a string.
6. Two constructors; the first one without arguments. The second constructor with one parameter r. It initializes the radius to r.
1. Design and implement the class Cylinder that inherits the class Circle and contains one double private data field height and the following member methods:
2. getHeight that returns the height of Cylinder object.
3. setHeight that sets the height of Cylinder object.
4. area that calculates and return the area of a Cylinder object
(area = 2**r+2**r*h).
1. volume that calculates and return the volume of a Cylinder object
(volume = *r*h).
1. toString that returns the radius and height of a Cylinder object as string.
2. Two constructors; the first one without arguments. The second constructor with two parameters r and h. It initializes the radius to r and the heightto h.
1. Using sentinel controlled loop, write Test_Driver program to read radius and height of 20 Cylinder objects and store them in an array. Your program must be able to output, for Cylinder object, its radius, height, area and volume.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
