[SOLVED] CSE 108 Assignment #5

25.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

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!

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.