Write an inheritance hierarchy for classes Quadrilateral, Trapezium, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Make the hierarchy as deep (i.e., as many levels) as possible. Specify the instance variables and methods for each class. The private instance variables of Quadrilateral should be the four end points of the Quadrilateral. Write a program that instantiates objects of your classes and outputs each object's area.
With Best Regards,
Shyam Prasad Murarka
Make the hierarchy as deep (i.e., as many levels) as possible.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
With Best Regards,
Shyam Prasad Murarka
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
With Best Regards,
Shyam Prasad Murarka
The Liskov Substitution Principle tells me any test that works for rectangle should also work for any derived class. Will that test work for square? Or did square overload setHeight and setWidth to change both height and width since they are required to be equal?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
Wow, at 17 I had almost mastered the four function calculator. Of course they were brand new and cost $400. Keep coding, keep posting, keep it fun. Sorry if my post went off the complexity deep end!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
My senior year of HS my dad got an HP programmable calculator for his college teaching. About the size of a typewriter with a 4-register stack and a thermal writer like a bad cash register. I turned in physics homework with these smelly little listings stapled to it and got some interesting comments. The same functionality fit in a shirt pocket the next year, I think.
Oh, geez, I just realized what a bad analogy that was. You probably haven't ever seen a typewriter either!!
[ May 10, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Our first order of business must be this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|