Question: Using C + + : Create a class called Triangle that holds information about a right angle Triangle. Your Triangle class should have two properties,

Using C++:
Create a class called Triangle that holds information about a right angle Triangle. Your Triangle class should have two properties, base and height. These should both be doubles. Properties are the values that makeup the data section of the class. Your class should have the following public functionality:
Constructors:
Default - sets base and height to 1
Overloaded - sets base and height to double values passed as arguments
Functions
Mutators:
setBase - Used to set the base of the Triangle
setHeight - Used to set the height of the Triangle
Accessors
area - produces the area of your Triangle. This can be calculated use 1/2(base * height). hypotenuse - produces the hypotenuse of your Triangle. This is also known as side C of a right angle triangle with the base being B and Height being A. Side C can be
solved using A squared + B Squared = C Squared
perimeter - Produces the perimeter of your Triangle. This is nothing more than the sum of the three sides.
NOTES:
All functions of the class should operate on the data section of the class in some way. If you have written functions that do not, then you should rethink your solution
The class definition must contain prototypes only. The scope resolution operator must be used to define the functions of the class.
 Using C++: Create a class called Triangle that holds information about

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!