A) Specifications
In this assignment, you will implement the mathematical object - a regular hexagon - as an abstract data type (i.e. as a class). A regular hexagon is a polygon with six edges of equal length - organized in a way that all the interior angles are equal. One can think of it as six equilateral triangles put together. Since all the properties about a hexagon are completely determined given just the length of the side, the class should need only one private member - the side. You will need to implement the following public functions for the class:
1) void setSide(double) - initialize the side of the hexagon
2) double getSide() - return the side of the hexagon
3) double getDiagonal() - return the length of the diagonal of the hexagon (diagonal = 2 * side ?)
4) double getPerimeter() - return the length of the perimeter of the hexagon (perimeter = 6 * side ?)
5) double getArea() - return the area of the hexagon. The area of a hexagon is given by the following formula: Area = (3 * square_root(3) / 2) * side2
6) double AreaOfOuterCircle() - return the area of the "outer" circle that circumscribes the regular hexagon.
7) double AreaOfInnerCircle() - return the area of the "inner" circle circumscribed by the regular hexagon.
You also need to implement a constructor for the class. The constructor should take a parameter which is used to initialize the side of the hexagon. In the constructor, print out the message "We are creating a hexagon with side = ", and print out the side of the hexagon. The side is given as a parameter to the constructor.
In the main function, you will need to implement the necessary pieces of code that "try out" the test cases. Before a particular test is performed, you should always print a message prompting the user of the test that you are about to perform.
B) Testing
There are totally two tests you should perform in the program. In each test, you should use the member functions of the class to print out all the data about the hexagon (i.e. side, diagonal, perimeter, and its area). You should also print a message that says "The data of the hexagon are as follows:" before you generate all the hexagon data on the screen.
Test One: Create a hexagon object via the constructor using the initial side value of 4.0. After the object is created, print all the data about it on the screen (don't forget to print the prompting message first).
Test Two: This time, you ask the user for the side and initialize the hexagon with user input using the appropriate member function. Then, just output all the data about the hexagon on the screen like what you did in test one.
C) Bonus
1) Students who use a loop in the main function when asking for the user for input - so that the user can repeatedly test the program with different inputs until the user enter "Q" as an input - will receive a decent amount of bonus points. Points will only be given, however, if screenshots are provided.
2) Input validation - students who check if user's inputs are valid (e.g. length > 0?) will receive a decent amount of bonus points.