This is my thing i have to do ..
Build a inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the base class of the hierarchy. Create and use a Point class to represent the points in each shape. Make the hierarchy as deep (i.e., as many levels) as possible. Specify the instance variables, properties, and methods for each class. The private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. Write a program that instantiates objects of your classes and outputs each object's area (except Quadrilateral).
Can anyone help it out ..
I am totally went wrong when i read this "The private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral"
So help me
Cheers
TY

VulpesPosted Nov 4, 2013, 7:04 AM
Here's an improved version which adds constructor overloads to the Rectangle and Square classes to distinguish them from Parallelogram. Notice that Square now inherits from Rectangle rather than directly from Parallelogram. The results are the same as before:
VulpesPosted Nov 8, 2013, 7:34 PM
They appeared in the above program in expressions such as P1.X and P2.Y.
Posted Nov 8, 2013, 12:19 PM
public double X { get {return _x;} }
public double Y { get {return _y;} }
VulpesPosted Nov 8, 2013, 9:45 AM
This effectively makes the Point class immutable - one you've created an instance you can't change it.
Posted Nov 8, 2013, 9:16 AM
public double X { get {return _x;} }
public double Y { get {return _y;} }
Posted Nov 7, 2013, 8:03 AM
VulpesPosted Nov 7, 2013, 7:59 AM
Square and rectangle are easy as you know that opposite sides are parallel to each other and that all sides are equal in the case of a square.
For parallelogram it's just a matter of offsetting the points for the top (or bottom) vertices of a rectangle so the whole figure is slanted to one side.
In the case of a trapezoid, two sides are parallel to each other so I just had to choose the points
for the other two sides so they wouldn't be parallel.
Finally, for quadrilateral, I just chose four points so that there would be no parallel sides.
I don't know of any online tool which can generate such points though the Wikipedia articles for these geometric figures may contain some examples.
Posted Nov 7, 2013, 7:07 AM
Quadrilateral
Trapezoid
Parallelogram
Rectangle
Square
I know only traditional way to use to decide those appropriate points. Is there any website tool available to make work easy?
VulpesPosted Nov 3, 2013, 7:56 PM