Question: as object oriented (JAVA) Question-1 (100 Points) 1. Create a class named Cylinder. 2. The class has two attribute, radius and height. The attributes are

 as object oriented (JAVA) Question-1 (100 Points) 1. Create a class

as object oriented (JAVA)

Question-1 (100 Points) 1. Create a class named Cylinder. 2. The class has two attribute, radius and height. The attributes are set to 1 in the default constructor. The attributes should only be visible in the class. 3. Create another fully parameterized constructor that takes all the attributes as parameters. 4. Provide set and get methods for all attributes. The set methods should verify that the values are positive. Never allow negative values for any attribute. 5. Provide two methods to calculate the surface area and the volume of the cylinder according to the formulas shown below. Surface Area = 2(pi r2) + (2 pir)*h volume = T* p*h 6. Provide a utility method (getDetails) that returns a formatted string about the details of the hemisphere object. It should print the radius, height, surface area, and volume each in a separate line with a proper message. All values should be set to two decimal places. See sample output. Cylinder Radius = 3.20, Height = 1.99 Surface Area = 128.04 Volume = 64.02 7. Write a tester program to test the Hemisphere class. a) Create two different objects in it. Use a different constructor for each of them. Set their parameters. b) Print the details of both objects

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!