In last project we created an abstract class Shape then a Point class that extends Shape, and then, a class for Square,
Posted: Tue Apr 12, 2022 10:23 am
In last project we created an abstract class Shape then a Point
class that extends Shape, and then, a class for Square, that
extends Point (a Square 'is-a' point with 2 sides), and lastly, a
Cube class that extends Square (a Cub 'is-a' Square with a depth).
Okay so now, we have a shape hierarchy. Shape (abstract) Point
(extended) Square (extended) Cub (extended) To these, for this
project, you need to add some more shapes These are: Circle, &
Cylinder. So we will have: Cylinder (extended) Circle (extended)
Shape (abstract) Point (extended) Square (extended) Cub (extended)
I will provide you with a driver that creates one of each shapes,
adds them to an array of Shapes, and then prints out everything we
know about each one. After that it creates an array of type Shape
and assign all of the above shapes to be an element of the array.
Then lastly, in a for loop print-out all known information about
each element of the array. For the last part we are treating /
handling each as type Shape.
*Make your own class Shape*
Square.java
Point.java
Cube.java
class that extends Shape, and then, a class for Square, that
extends Point (a Square 'is-a' point with 2 sides), and lastly, a
Cube class that extends Square (a Cub 'is-a' Square with a depth).
Okay so now, we have a shape hierarchy. Shape (abstract) Point
(extended) Square (extended) Cub (extended) To these, for this
project, you need to add some more shapes These are: Circle, &
Cylinder. So we will have: Cylinder (extended) Circle (extended)
Shape (abstract) Point (extended) Square (extended) Cub (extended)
I will provide you with a driver that creates one of each shapes,
adds them to an array of Shapes, and then prints out everything we
know about each one. After that it creates an array of type Shape
and assign all of the above shapes to be an element of the array.
Then lastly, in a for loop print-out all known information about
each element of the array. For the last part we are treating /
handling each as type Shape.
*Make your own class Shape*
Square.java
Point.java
Cube.java