Question: Files to Create: triangle.h - Header file for the RightTriangle class.triangle.cpp - Implementation file for the class methods.main.cpp - Main program file that uses the
Files to Create:
triangle.h Header file for the RightTriangle class.triangle.cpp Implementation file for the class methods.main.cpp Main program file that uses the RightTriangle class.
Class Requirements:
Constructor: Should take the base and the height as arguments. Throw an std::invalidargument if negative values are passed.Area Method: Calculate the area using the formula Areabaseheight Perimeter Method: Calculate the perimeter using the Pythagorean theorem to find the hypotenuse: PerimeterbaseheightbaseheightDisplay Method: Output the base, height, area, and perimeter to the console.
Functionality: The program should prompt the user to enter the base and height of the triangle, create a RightTriangle object, display the triangle's details, and handle any potential exceptions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
