Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago