Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write, debug, and test a group of classes in an object-oriented language of your choice that implement the following object hierarchy. Include another class called

Write, debug, and test a group of classes in an object-oriented language of your choice that implement the following object hierarchy. Include another class called TestObjectHierarchy that contains a main method and demonstrates the functionality of all of the classes.

Here are some helpful geometry reminders: Perimeter of an ellipse: https://www.mathsisfun.com/geometry/ellipse-perimeter.html Area of an ellipse: https://www.math.hmc.edu/funfacts/ffiles/10006.3.shtml Circumference of a circle: 2 * ? * r Area of a circle: ? * r2 Perimeter of a rectangle: 2 * (w + h) Area of a rectangle: w * h interface Shape double getPerimeter() double getArea() class Ellipse implements Shape double getMajorRadius() void setMajorRadius(double r) double getMinorRadius() void setMinorRadius(double r) class Circle extends Ellipse double getRadius() // A Circle is an Ellipse whose major and minor radii are congruent; this rule can be enforced by overriding the appropriate methods in the base class void setRadius(double r) double getCircumference() // this is the same as the perimeter calculated in the base class class Rectangle implements Shape double getWidth() void setWidth(double w) double getHeight() void setHeight(double b) class Square extends Rectangle double getSideLength() // a Square is a Rectangle whose height and width are congruent; this rule can be enforced by overriding the appropriate methods in the base class void setSideLength(double s)

Your Own Object Hierarchy Now that you have had some practice, design and implement your own object hierarchy. Just like the first part of the assignment, this should be a hierarchy that might be useful in the real world. Include the following: At least one abstract base class At least one interface At least two concrete classes (at least one of these should inherit from the abstract base class you created, and at least one should implement the interface you created) At least one overridden method At least one delegated method A test program to show off your hierarchys functionality Include a description of the hierarchy in the test programs header comment as well as descriptions of all the classes in their respective header comments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago