I need some help adding some function to the main program.
This is the functions that need to be add.
Include triangle validation in the method store_sides before assigning the sides to the private variables – instead of storing the values, it should just cout << “Not a valid triangle, using default constructor values” ” << endl; when an invalid triangle is entered – you will not assign the default values here that will be done in the constructor method, you just don’t assign the value to the sides so the sides by default will be what is assigned in the constructor. To validate a triangle, the length of any two sides must be larger than the other side.
Add a constructor method that will cout << “Triangle construction” << endl; and set the default values. This should set all sides to a default of 1 (you may to set other items to default values depending on how you have implemented your class – like area/perimeter)
Add a destructor method that will just cout a message to the screen.
cout << “Triangle destruction”;
Add a triangle type method that will determine the type of triangle you have. This method should return a string. The triangle type method will return the string “equilateral” (if all three sides are equal), “isosceles” (if any two sides are equal), or “scalene” (if none of the three sides are equal). Your output should be modified to include this type returned from your method. Remember will need to include #include <string> to add the string data types.
Instead of two triangles objects, only create one triangle object. However have this triangle object created inside a while (or do-while) loop, such that you prompt the user if they want to continue entering more triangles (remember when checking char’s for Y/y the functions toupper or tolower can come in handy) — thus you are “reusing” the one object each time through the loop (this will allow you to see the constructor/destructor cout messages each time through the loop).
This step is not required for this assignment, but if you are looking to push yourself, add another method that calculates all three angles of the triangle based on the side lengths – you will have to use some other math functions we haven’t covered and figure out the math behind it if you don’t already know.