Question: In this assignment you will practice using inheritance. It is slightly shorter than usual because Unit 5's programming homework is longer. Q1 : Design and

In this assignment you will practice using inheritance. It is slightly shorter than usual because Unit 5's programming homework is longer.

Q1: Design and then implement three different classes that work together to define shapes: RoundShape, Cylinder, and Cone. For each class, store fundamental data about its size and provide methods to access and modify this data. In addition, provide appropriate methods to compute the area, and volume, for Cylinder and Cone. In your design, consider how shapes are related and thus where inheritance can be implemented. Don't create duplicate instance variables. Use the UML diagram below as a guide:

In this assignment you will practice using inheritance. It is slightly shorter

Create a main method which instantiates 2 Cylinder objects (any parameters), 2 Cone objects (any parameters), display them with ToString(), change one parameter (your choice) in each, and display them again. Attached is a base file that will help you define the different classes in the same file. Although it is not best practice, for this assignment we ask that you combine your classes into a single file to keep your files together. Remember that you MUST rename the base file and class to contain your last name. [25 points]

Sample Output:

than usual because Unit 5's programming homework is longer. Q1: Design and

RoundShape height double radius double RoundShape(r double, h double) get Radius() double getHeight double 0 setHeight(h double) void set Radius(r: double) void getArea0 double get Volum 0 double Cylinder Cone RoundShape(r double, h double RoundShape(r double, h double getArea0 double getArea0 double getVolume() double getVolume() double toString(): String toString(): String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!