2. Hierarchy of the classes is designed as the following Shape ← Point ← Circle← Cylinder getArea getVolume Shape Point Circle Cylinder 0.0 0.0 0.0 2rr²+ 2πrh 0.0 0.0 0.0 лr²h abstract "Point" "Circle" "Cylinder" getName toString default object implementation [xy] center=[x,y]; radius=r center=[x,y]; radius=r; height = h Class Shape is abstract Point class has x and y coordinates, constructor, accessor,mutators and toString method. ● Circle class has radius, constructor, accessor, mutators, Diameter, Circumeference, Area and toS methods. • Cylinder class has height, accessor, mutator,Area, Volume and toString methods. All shapes have an area and volume. The volume of two dimensional shapes is always zero and dimensional shapes have positive non-zero volume. Implement appropriate methods and class definitions. Write "Test" class and create object of the thre classes Point, Circle and Cylinder. Use array of Shape variables. Show each object's name and data(i

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

use java to run the program of the question below and show the exact ouput of the question

2. Hierarchy of the classes is designed as the following
Shape ← Point ← Circle← Cylinder
getArea
getVolume
Shape
Point
Circle
Cylinder
●
0.0
0.0
0.0
2πr² +
2πrh
0.0
0.0
0.0
πr²h
abstract
"Point"
"Circle"
"Cylinder"
getName
toString
default object
implementation
[xy]
center=[x,y];
radius=r
center=[x,y];
radius=r;
height = h
Class Shape is abstract
Point class has x and y coordinates, constructor, accessor,mutators and toString method.
Circle class has radius, constructor, accessor, mutators, Diameter, Circumeference, Area and toString
methods.
Cylinder class has height, accessor, mutator, Area, Volume and toString methods.
All shapes have an area and volume. The volume of two dimensional shapes is always zero and three
dimensional shapes have positive non-zero volume.
Implement appropriate methods and class definitions. Write “Test” class and create object of the three
classes Point, Circle and Cylinder. Use array of Shape variables. Show each object's name and data(i.e. x-y
coordinate pair, radius and height, depending on each object's type)
Transcribed Image Text:2. Hierarchy of the classes is designed as the following Shape ← Point ← Circle← Cylinder getArea getVolume Shape Point Circle Cylinder ● 0.0 0.0 0.0 2πr² + 2πrh 0.0 0.0 0.0 πr²h abstract "Point" "Circle" "Cylinder" getName toString default object implementation [xy] center=[x,y]; radius=r center=[x,y]; radius=r; height = h Class Shape is abstract Point class has x and y coordinates, constructor, accessor,mutators and toString method. Circle class has radius, constructor, accessor, mutators, Diameter, Circumeference, Area and toString methods. Cylinder class has height, accessor, mutator, Area, Volume and toString methods. All shapes have an area and volume. The volume of two dimensional shapes is always zero and three dimensional shapes have positive non-zero volume. Implement appropriate methods and class definitions. Write “Test” class and create object of the three classes Point, Circle and Cylinder. Use array of Shape variables. Show each object's name and data(i.e. x-y coordinate pair, radius and height, depending on each object's type)
Example Output:
Point: [7,11]
Circle: Center [22,8]; Radius=3.5
Cylinder: Center=[20,30]; Radius=3.3; Height= 10.75
Point: [711]
Area= 0.0
Volume= 0.0
Circle: Center [22 8]; Radius= 3.5
Area 38.48
Volume 0.0
Cylinder: Center=[20 30]; Radius=3.3; Height-10.75
Area 291.32
Volume= 367.78
Transcribed Image Text:Example Output: Point: [7,11] Circle: Center [22,8]; Radius=3.5 Cylinder: Center=[20,30]; Radius=3.3; Height= 10.75 Point: [711] Area= 0.0 Volume= 0.0 Circle: Center [22 8]; Radius= 3.5 Area 38.48 Volume 0.0 Cylinder: Center=[20 30]; Radius=3.3; Height-10.75 Area 291.32 Volume= 367.78
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education