Question: Write a Java program to create a class called Shape with abstract methods for calculating area and perimeter, and subclasses for Rectangle , Circle ,

Write a Java program to create a class called Shape with abstract methods for calculating area
and perimeter, and subclasses for Rectangle,Circle, and Triangle.
Write a Main class that creates instances of different shape objects. It then calls methods to
calculate the area and perimeter of each shape and displays the results in the console.
Hint: Rectangle (Area =, Perimeter =2*(l+))
Circle (Area =2
, Perimeter =2)
Triangle (Area =s (s side1)(s side2)(s side3) where s =
(side1+ side2+ side3)/2, Perimeter = side1+ side2+ side3)

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 Programming Questions!