Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
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 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started