Starting from:

$29.99

OOP CSE 108 Assignment #5 Solution


In this assignment, you need to explore “inheritance” in Java. Let’s go back to assignment 3 where there was a Shape class and some other classes which inherited its property. You need to do something similar to that for this assignment.

In this assignment the following classes/interfaces are essential:

Shape
Circle
Cylinder
Sphere
Square
Cube
Area
Volume

The basic idea is:
“Circle, cylinder, sphere, square and cube are different type of shapes. Circle and square have area. Cylinder has a volume, surface area and base area. Sphere and cube has volume.”

You need to throw a custom exception if the user provides any invalid input (i.e. negative radius).

Implement this scenario using the idea of OOP. No source code will be provided for this assignment. You need to do everything by yourself. After completing these classes, write the main function to test these. A sample output of this assignment is given which will give you a good idea what you need to do.

Assessment: Marking will heavily rely on coding style, OOP understanding and efficiency. So try to think in an OOP way.

Good Luck!

More products