Your program should use text files as the only input. No keyboard input is permitted. The path to the input file should be the first parameter to the program.
Format output exactly as specified/exemplified in the descriptions
Follow good code writing practices:
Do not use global variables
Divide classes into .cpp and .h files
All parameters that are constants should be declared as such
All variable and class names should be in English, self-explanatory, and must use camelCase.
All code that is not used should be removed
Use code comments when the reasoning behind the solution is not obvious
Always check that that all allocated memory is released and avoid memory leaks
You should not use any external libraries other than cmath, iostream, fstream, and strings. If you wish to use another library please check with the lab assistants first.
The program should be robust against wrong input data. If there is an error with input file the program should gracefully terminate with a non zero exit code.
Real numbers should be printed with the precision of 3 decimal digits.
Implement an abstract class Shape with methods:
getType() returns a string denoting the type of a shape (point, line, polygon, triangle)
area() returns area of the object, or -1 if the shape is concave, intersecting, or does not have an area
circumference() returns circumference of the object
position() returns center coordinates of the object, or the center of the bounding box if the shape is not convex.
isConvex() returns true if shape is convex
distance(Shape s) returns distance to the center of another shape
Extend the Object classes into Point, Line, Triangle, and Polygon. Overload the inherited methods. Constructors of these classes take vertices coordinates as an input.
The program should load a shape from a file and output its surface area. The input file contains a series of real numbers indicating coordinates of vertices. Example:
1 2 3 4 5 6.43 // Denotes a triangle with vertices at (1, 2) (3, 4) (5, 6.43)
There should not be a limitation of how many points the program can load.
Input: 1 1 1 2 2 2 Output: 0.5
Input: 1 3.4 3 3 13.13 3 Output: 2.026
Input: 1 1 1 2 2 2 3 1 2 0 Output: 2.5
Input: 0 -10 Output: -1