Question: Q6. Write a program to create an abstract class called Shape that stores the dimensions of a three- dimensional object. It also defines a parameterized

Q6. Write a program to create an abstract class called Shape that stores the dimensions of a three- dimensional object. It also defines a parameterized constructor, and an abstract method called area() that returns the area of an object. The program derives two subclasses from Shape. The first is Rectangle and the second is Triangle. Override the method area() so that it returns the area of a rectangle and a triangle respectively. Supply a test program that uses polymorphism to test these classes and methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
