Please write in C++. Thank you in advance. Requested files : GeometricArea.cpp,
ID: 3840369 • Letter: P
Question
Please write in C++. Thank you in advance.
Requested files: GeometricArea.cpp, SpecificationException.h, SpecificationException_test.cpp
Maximum number of files: 4
Extend the GeometricArea.cpp program you wrote to use an exception to handle user input where the parameters entered do not meet specifications, or that simply don't make sense. In the case of GeometricArea this occurs when the number of sides is two (2).
You should create a class SpecificationException that is thrown whenever your program encounters a specification that does not make sense. For example, if your program is asked to compute the area of a 2 sided polygon, You should throw a SpecificationException, because the fewest number of sides a polygon can have is 3..
You can create this class using only an interface (or header) file called SpecificationException.h. Simply include this header file in your GeometricArea.cpp source code and you can use that exception object..
The test driver for this program is named SpecificationException_test.cpp because it is supposed to call GeometricArea functions with values that trigger an exception.
This is my code for GeometricArea.cpp
GeometricArea.h
GeometricArea.cpp
GeometricArea_test.cpp
Explanation / Answer
Cpp program:
GeometricArea.cpp
GeometricArea_test.cpp