Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Inheritance - Testing Point, Square, and Cube Classes

1. ## 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?

2. ## 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.