Question: using c++. Design and write classes in a class hierarchy to describe different types of geometric shapes. Provide information in the classes in order to
using c++. Design and write classes in a class hierarchy to describe different types of geometric shapes. Provide information in the classes in order to compute the area of each of the shapes. Create three separate classes (Triangle,Rectangle,Circle) that are derived from a separate base class (Shape). Write a program that allows a user to create any of the different shape types. Prompt the user to select the shape type and enter the necessary dimensions (i.e. refer to formulas below; rectangle needs width and height, circle needs radius, triangle needs height and base). After the user has finished creating the shape, compute and print out the area.
Use the following formulas for your program:
| Triangle: | area = * base * height |
| Rectangle: | area = width * height |
| Circle: | area = PI * radius2 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
