Question: Using C++, write a program to calculate the area and perimeter of four simple plane figures: a rectangle, a circle, a square and a triangle.

Using C++, write a program to calculate the area and perimeter of four simple plane figures: a rectangle, a circle, a square and a triangle. The program should begin by explaining itself to the user. It must then prompt the user for appropriate input (i.e: ask the user to select a rectangle, circle, square or triangle and then ask for necessary information based on the users selection). Next, the program must calculate and output the perimeter and area of the appropriate figure and then ask the user if he or she would like to find the perimeter and area of another figure. We will assume all plane figures are measured in centimeters. The program MUST take advantage of the concepts of Inheritance and Polymorphism. A base class must be defined (you can call it whatever you like, but better has a meaningful name, such as PlaneFigure might be a good choice). Other classes (for example, Rectangle, Circle, Square and Triangle) must be derived from the PlaneFigure base class. Also, two methods must be defined for the PlaneFigure class: perimeter and area. These methods are to be overridden for each derived class. Your program should be well documented and easy to read.

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