Question: Develop a Java console application that creates two classes with the following specifications: Class Circle: Instance variables: radius (holds the radius value; appropriate data type).
Develop a Java console application that creates two classes with the following specifications:
Class Circle:
Instance variables:
radius (holds the radius value; appropriate data type).
color (holds the circle color name; appropriate data
type).
A two argument constructor.
Getters and setters for radius and color.
Method getArea() that returns the area of the circle.
Overridden toString() that displays string representation of the circle object.
Class Cylinder that is extended from the class Circle:
Instance variable:
height (holds the height of the cylinder)
A three argument constructor.
Getter and setter for height.
Method getVolume() that returns the area of the circle.
Overriden toString() that displays string representation of the cylinder object.
Driver class TestCylinder:
Creates a menu to choose from Circle or Cylinder.
Asks to enter data for either the circle or the cylinder depending on the selection.
Displays the objects created with their string representations.
Please note:
Make sure to get continuous input till one intends to quit entering data.
View as PageDownloadToggle Fullscreen
Send to BinderReflect in ePortfolioDownload
java programming
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
