Inheritance - Testing Point, Square, and Cube Classes
I am creating a program which has the following requirements:
-Class named Point must be superclass of the hierarchy
-Square and Cube are subclasses of Point
-Private data of Point are the x and y coordinates
-Private data of Square is sideLength
-Private data of Cube is depth
-Use accessor, mutator, toString(), volume, and area methods when applicable
Given that the volume of a cube is length x width x height (depth) and the area of a square is length x width, the formulas to calculate these figures are very simple. However, I have really no idea how Point (x,y) play into this scenario. It seems to me that width, instead of x and y, would make more sense.
Doe anyone know what the program requirements are suggesting here, specifically relating to the Point class?
Re: Inheritance - Testing Point, Square, and Cube Classes
What sort of code have you laid out thus far? Have you started writing the Point or other classes yet? Try writing them out and post what you've done...it will provide much more context to address your question(s) specifically. What specific question about the requirements do you have? From there, each of Square and Cube can be specified in terms of a Point with the added values specified in the requirements.