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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,235
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default 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.

Similar Threads

  1. Inheritance questions....
    By smellyhole85 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 26th, 2010, 05:11 PM
  2. inheritance help
    By justin3492 in forum Object Oriented Programming
    Replies: 3
    Last Post: September 30th, 2010, 07:45 PM
  3. inheritance
    By b109 in forum Java Theory & Questions
    Replies: 3
    Last Post: May 30th, 2010, 09:23 PM
  4. [SOLVED] theory behind testing each element of an array.
    By etidd in forum Java Theory & Questions
    Replies: 2
    Last Post: February 5th, 2010, 08:04 AM
  5. Testing the DataSource with MySQL
    By srinivasan_253642 in forum JDBC & Databases
    Replies: 0
    Last Post: January 9th, 2010, 01:23 AM