#### Details of this Paper

##### Triangle class

**Description**

solution

**Question**

Create a Triangle class that has the following member variables;side1 - a double;side2 - a double;base (or side 3) - a double;height (the length of the perpendicular line dropped from a vertex to the base side) - a double;The class should have the following member functions;default constructor that sets the value of all 4 member variables to 0.0;a constructor with arguments that accepts values for all 4 member variables as arguments;setDimensions - a function that allows the value of all 4 member varialbes to be changed by the user;getDimensions - a function that accesses the value of all 4 member varialbes associated with the triangle object;getArea - a function that returns the area of a triangle: Area = 0.5 * base * height;getPerimeter - a function that returns the perimeter of a triangle: Perimeter = side1 + side2+ base;A displayTriangleInfo function that displays side1, side2, base, height, area, and perimeter for a triangle object.;After testing your code for a single object, create an array of 5 triangles, Use the setDimensions function to allow the user to set the values for all of the 4 member variables for each triangle. Use the getArea and getPerimeter functions to calculate the Area and Perimeter for the values entered for the member varialbes for each triangle. Finally use the displayTriangleInfo function to display all of the data for each triangle.;Submit the code with the array.;You can create additional function if you think they are needed.

Paper#68987 | Written in 18-Jul-2015

Price :*$22*