Question: java Surface area=ar V12 +h2 Volume = jarh Question-1 (100 Points) 1. Create a class named Cone. 2. The class has two attributes, radius and

java java Surface area=ar V12 +h2 Volume = jarh Question-1 (100 Points) 1.

Surface area=ar V12 +h2 Volume = jarh Question-1 (100 Points) 1. Create a class named Cone. 2. The class has two attributes, radius and height. Both 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 the both attributes as parameters. 4. Provide set and get methods for both attributes. The set methods should verify that the radius and height values are positive. Never allow negative values for both attributes. 5. Provide two methods to calculate the surface area and the volume of the Cone according to the following formulas shown above. Use the Pl value from the Moth class whenever needed 6. Provide a utility method (getDetails) that jeturns a formatted string about the details of the Cone object. It should print the radius, 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. Cone Radius - 3.20, Height = 1.99 Surface Area = 37.88 Volume = 21.34 7. Write a tester program to test the Cone 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!