Write a java program using BlueJ to perform the following operations, i. Create an abstract class called Figure with attribute radius and height, a final field PI whose value is 3.14. ii. Add abstract methods volume() and print() to the Figure class. iii. Create a class called Cone and Cylinder as subclasses for the Figure class. Add a field coneVolume and cylinderVolume in Cone and Cylinder class respectively to store the volume. iv. Implement the method volume() in Cone and Cylinder to find the volume of Cone and Cylinder.(Hint : Formula for cone volume is 1/3*PI*radius*radius*height and cylinder is PI*radius*radius*height ) v. Implement the method print() in Cone and Cylinder class that displays radius, height, and volume.
Write a java program using BlueJ to perform the following operations,
i. Create an abstract class called Figure with attribute radius and height, a final field PI
whose value is 3.14.
ii. Add abstract methods volume() and print() to the Figure class.
iii. Create a class called Cone and Cylinder as subclasses for the Figure class. Add a field coneVolume and cylinderVolume in Cone and Cylinder class respectively to store the volume.
iv. Implement the method volume() in Cone and Cylinder to find the volume of Cone and Cylinder.(Hint : Formula for cone volume is 1/3*PI*radius*radius*height and cylinder is PI*radius*radius*height )
v. Implement the method print() in Cone and Cylinder class that displays radius, height, and volume.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images