Consider the following diagram that details the classes Circle and Cylinder. The second row for each box (class) represents the data member (characteristics) of the classes and the third row lists the methods, including constructors, (behavior) of the classes. (Please note that -/+ sign represents private and public modifiers respectively.) Create these two classes, with class Cylinder inheriting the class Circle. Also, using your newly created classes, write a program that asks the user to input the radius and height of a cylinder and prints its surface area and volume.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Consider the following diagram that details the classes Circle and Cylinder. The second row for each box (class) represents the data member (characteristics) of the classes and the third row lists the methods, including constructors, (behavior) of the classes. (Please note that -/+ sign represents private and public modifiers respectively.) Create these two classes, with class Cylinder inheriting the class Circle. Also, using your newly created classes, write a program that asks the user to input the radius and height of a cylinder and prints its surface area and volume.

Circle
- radius: double
+ Circle()
+ Circle(double)
+ setRadius(double): void
+ getRadius(): double
+ getArea(): double
+ toString(): String
Cylinder
- height: double
+ Cylinder()
+ Cylinder(double, double)
+ setHeight(double): void
+ getHeight(): double
+ getArea(): double
+ getVolume(): double
toString(): String
Transcribed Image Text:Circle - radius: double + Circle() + Circle(double) + setRadius(double): void + getRadius(): double + getArea(): double + toString(): String Cylinder - height: double + Cylinder() + Cylinder(double, double) + setHeight(double): void + getHeight(): double + getArea(): double + getVolume(): double toString(): String
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT