Answered step by step
Verified Expert Solution
Link Copied!

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 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 to Expert-Tailored 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

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

LO6 List the components of job descriptions.

Answered: 1 week ago

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago