Question: The only way you must solve this is to include creating the main file and several classes: Square, Pentagon, Heptagon, and Decagon. Additionally, there will

The only way you must solve this is to include creating the main file and several classes: Square, Pentagon, Heptagon, and Decagon. Additionally, there will be header and implementation files for each class. I need a really good answer, so please take your time understanding the instructions below to accurately complete it with the necessary implementation and error checking. The checklist should be used too). :)
C++ PROGRAMMING: PolyMORPHISM ASSIGNMENT INSTRUCTIONS
OVERVIEW
The objective of this assignment is to give you some practice using inheritance, virtual functions, and polymorphism. With a focus on dynamic binding, this program shifts the focus from designtime static binding of functions to objects to run-time (or dynamic binding). It leverages the use of virtual functions and introduces the concept of abstract and concrete classes in its implementation of pure virtual functions as it also demonstrates polymorphic behavior.
There are some helpful links at the bottom of the instructions.
Ask the professor questions early if you need help with the assignment. Remember, this is a short week.
Note: Week 8 is a short week. The instructions include several items that will help to speed your project up.
Tip: One of students' most common problems with this Lab is getting the #include statements mixed up. This will generate several different types of errors.
Below is a diagram of the hierarchy of the Classes that can help you visualize how the #includes work by showing you which Class includes which Class.
Most common error situation: If you include file 'A' in your main() and file 'A' includes file 'B', then your main also has access to file 'B' through the #include of file 'A'.
For the diagram below, you will need the following #include statements. You can choose to copy/paste the items below, but you will not learn the 'why'. Take the time and look at the list and compare it to the diagram.
Review the class diagram and check your #include statements.
In the main() file
#include "Square.h";
#include "Pentagon.h";
#include "Heptagon.h";
#include "Decagon.h";
In Square.h
#include "Shape.h";
In Square.cpp
#include "Square.h";
In Pentagon.h
#include "Shape.h";
In Pentagon.cpp
#include "Pentagon.h";
In Heptagon.h
#include "Shape.h";
In Heptagon.cpp
#include "Heptagon.h";
In Decagon.h
#include "Shape.h";
In Decagon.cpp
#include "Decagpm.h";
The diagram below shows the relationships between the Classes for the Lab 8.
INSTRUCTIONS
Create a base class called Shape.
a. All Shapes have a shapeType i.e. "Square", "Pentagon", "Heptagon", "Decagon", a shapeName (user defined), a numberSides, and a sideLength which is generated as a random number. The number of sides for each type are:
i. Square 4
ii. Pentagon 5
iii. Heptagon 7
iv. Decagon 10.
b. Provides a constructor that allows the shapeName and sideLength to be set by the client when the object is created. This constructor should also output the message "Invoking Shape 2-argument constructor."
c. Provides a destructor for this class that outputs the message "Invoking Shape destructor." This destructor is virtual, which means that this destructor will fire, and the destructor from the inherited class will fire.
d. Provides a function called calcPerimeter() that will calculate and return the Perimeter. The formula is numberSides * sideLength.
e. Provides a function called displayShapeInfo() that cannot be implemented. That is, it should be declared as a purely virtual function.
f. Provides Get and Set methods to allow the shapeName, shapeType, numberSides, and sideLength to be accessed.
Note: The setter for shapeName and sideLength must be located in the private section of the .h file. This is because these data members are Read Only to the world outside the class. Only this class or the class that inherits from this class will be able to access these setters when they are in the private section.
From the Shape class, derive the Square, Pentagon, Heptagon, and Decagon classes.
a. The derived classes should each have a constructor and destructor that output an appropriate message (e.g., the Square constructor outputs "Invoking Square 2-argument constructor," and the Square destructor outputs "Invoking Square destructor", etc.).
b. The constructor of each derived class should allow the shapeName and sideLength of the Shape to be passed directly to the constructor of the base class. The derived constructor body will then use the base class private setters to pass in the hard-coded shape type and number of sides using the setShapeName() and setNumberSides() setters.
Example: The example below shows 2 parameters received by the derived
class constructor and those parameters being passed to the base class constructor.
c. The derived classes should each have a member function called displayShapeInfo() that o
 The only way you must solve this is to include creating

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!