Exercise 2: A. Write static methods: public static double cubeVolume(double h) : h public static double cubeSurface(double h) : 6h2 public static double cylinderVolume(double r, double h) : hnr? public static double cylinderSurface(double r, double h) : 2rnh + 2nr? that compute the volume and surface area of a cube with height h, and a cylinder with circular base with radius r and height h. Place them into a class named "Geometry.java". Then write a program with main class called "Lab7_yourlID.java" that prompts the user for the values of r and h, calls the four methods, and prints the results. B. (Optional) Reconsider your previous solution by implementing classes Cube, and Cylinder separately instead of a single class "Geometry" (part A). Which approach is more object-oriented?
Exercise 2: A. Write static methods: public static double cubeVolume(double h) : h public static double cubeSurface(double h) : 6h2 public static double cylinderVolume(double r, double h) : hnr? public static double cylinderSurface(double r, double h) : 2rnh + 2nr? that compute the volume and surface area of a cube with height h, and a cylinder with circular base with radius r and height h. Place them into a class named "Geometry.java". Then write a program with main class called "Lab7_yourlID.java" that prompts the user for the values of r and h, calls the four methods, and prints the results. B. (Optional) Reconsider your previous solution by implementing classes Cube, and Cylinder separately instead of a single class "Geometry" (part A). Which approach is more object-oriented?
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 15RQ
Related questions
Question
Java language
![Exercise 2:
A Write static methods:
public static double cube Volume(double h) : h
public static double cubeSurface(double h) : 6h2
public static double cylinderVolume(double r, double h) : hTr
public static double cylinderSurface(double r, double h) : 2rnh + 2r?
that compute the volume and surface area of a cube with height h, and a cylinder with
circular base with radius r and height h. Place them into a class named
"Geometry java". Then write a program with main class called "Lab7 yourlD java"
that prompts the user for the values of r and h, calls the four methods, and prints the
results.
B. (Optional) Reconsider your previous solution by implementing classes Cube, and
Cylinder separately instead of a single class "Geometry" (part A). Which approach is
more object-oriented?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7d708591-c20b-4af9-b60b-dcdcc87351c8%2Ffdc0d90f-7cfe-4c6e-89d6-101a638f899f%2Fxkjldj_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Exercise 2:
A Write static methods:
public static double cube Volume(double h) : h
public static double cubeSurface(double h) : 6h2
public static double cylinderVolume(double r, double h) : hTr
public static double cylinderSurface(double r, double h) : 2rnh + 2r?
that compute the volume and surface area of a cube with height h, and a cylinder with
circular base with radius r and height h. Place them into a class named
"Geometry java". Then write a program with main class called "Lab7 yourlD java"
that prompts the user for the values of r and h, calls the four methods, and prints the
results.
B. (Optional) Reconsider your previous solution by implementing classes Cube, and
Cylinder separately instead of a single class "Geometry" (part A). Which approach is
more object-oriented?
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage