Question: In this question you are required to define a class named Cylinder that contain the following: Private instance variables radius and height. Default constructor

In this question you are required to define a class named Cylinder that contain the following:  Private

In this question you are required to define a class named Cylinder that contain the following: Private instance variables radius and height. Default constructor and constructor that takes two arguments radius, and height to initialize the instance variables. A public getter and setter method for radius and height. Public methods computeArea to calculate and return the area of the base ( area = n * radius ) (use Math class where appropriate ) Public method getVolume that calculate and return the volume (area = * radius ) * height). Please volume of the cylinder is 3.14 * radius *radius* height Define toString() and equals() method in the Cylinder class also 1. Write the code for the class Cylinder as described. 2. Write a tester class main method that creates a Cylinder object using radius and height values entered by the user, then display area and volume of the cylinder with a precision of two digits after the decimal point. 3. Create an array of ten cylinder objects. After creating this array, use a lop to print all ten elements. 4. Create another two Cylinder objects and call the equals method and display its result.

Step by Step Solution

3.34 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Cylinderjava public class Cylinder instance variables private int radius private int height default constructor that initialize radius and height to d... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!