Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a java program Question-1 (100 Points) 1. Create a class named Hemisphere. 2. The dass has one attribute, radius. The attribute is set to

image text in transcribedwrite a java program
Question-1 (100 Points) 1. Create a class named Hemisphere. 2. The dass has one attribute, radius. The attribute is 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 attribute as a parameter. 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 square pyramid according to the formulas shown below. Volume: 2/3 *** Total Surface Area: A = 32 6. Provide a utility method (getDetails) that returns a formatted string about the details of the hemisphere 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. Hemisphere radius: 3.00 Surface Area= 84.82 Volume= 56.55 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

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

ISBN: 3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

=+ What skills and competencies will enable someone

Answered: 1 week ago

Question

=+to live and work wherever he or she wants?

Answered: 1 week ago

Question

=+How will this affect the recruiting process?

Answered: 1 week ago