Objective:
The goal of this assignment is to demonstrate a clear understanding of Object-Oriented Programming (OOP) principles in Java, specifically focusing on Inheritance and Method Overriding. You are required to design a program that manages different geometric shapes and calculates their areas using a common hierarchy.
Technical Requirements:
- Base Class: Create an abstract class named
Shape. This class should contain:- A protected
doublevariable to represent a primary dimension (like radius or side). - An abstract method
double calculateArea().
- A protected
- Subclasses: Implement at least two subclasses (e.g.,
CircleandSquare) that extend theShapeclass.- Each subclass must provide its own specific implementation of the
calculateArea()method. - For
Circle, use the formula: $Area = pi times r^2$. - For
Square, use the formula: $Area = side times side$.
- Each subclass must provide its own specific implementation of the
- Main Class: Include a
MainorDriverclass to instantiate these objects, set their dimensions, and print the calculated area to the console.
Requirements:

Leave a Reply
You must be logged in to post a comment.