Shape Hierachy

Hi everyone I am VERY new to java and need some help tackling this problem. I have to use hierachy to create a program that uses an array of Shape reference to objects of each concrete class in the hierachy.

shape> twodimensional or threedimensional -> twodimensional: circle, square, triangle or threedimensional: sphere, cube, tetrahedron.

I must determine whether the shape is two dimensional or three dimensional. If the shape is two dimensional I have to display it's area. If the shape is three dimensional I must diplay the area and volume.

I understand the later part where

circle extends twodimensional

but I just need help getting the ball rolling.

Thank you for your time.

[737 byte] By [Lex11a] at [2007-11-26 19:53:22]
# 1

The idea of hierachy is that you place the common attributes in parent class and specific ones in sub classes.

Example:

class Vehicle

+int numPlate

+int numWheel

+Color color

class Car extends Vehicle

+int zeroTo100time

class Lorry extends Vehicle

+int maxLoad

Hope that helps @_@

Icycoola at 2007-7-9 22:45:05 > top of Java-index,Java Essentials,New To Java...