Skip to content

task 5:

Saad Tariq requested to merge Task-5 into main

Write a program in java that computes the areas of Circle, Triangle and Rectangle using Run-Time polymorphism. HINT: 1. You can Use only one method name for calculating area of all the shapes - e.g:"calculateArea()". Inheritance is allowed. Solution: So in this case I have created different classes for different shapes which inherits the Area class and haves the same method to calculate the area i.e calculateArea this method is override by each class according to the need and that achieves run-time polymorphism.

Merge request reports