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::invalid_argument if negative values are passed.Area Method: Calculate the area using the formula Area=12baseheight .Perimeter Method: Calculate the perimeter using the Pythagorean theorem to find the hypotenuse: Perimeter=base+height+base2+height2.Display 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 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 Programming Questions!