Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions