Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program with exception handling to process right triangles which includes the following: A class for right triangles including o the 3

 Write a C++ program with exception handling to process right triangles which includes the following: A class 

Write a C++ program with exception handling to process right triangles which includes the following: A class for right triangles including o the 3 sides (a,b,c), and 3 angles (in degrees) of a right triangle as private data members. a b Constructors to initialize the sides of the triangle. o Get and set functions for the data members. Note that the angles a and B are calculated with the following formulas: a = arcsin (a / c) (inverse sine, asin(x) in cmath library); B = arcsin(b / c) (inverse sine, asin(x) in cmath library); Output operator overloading function to output the triangle's information as shown on the sample run. o Any other necessary functions. An exception class containing the 3 sides of a triangle as data members and any necessary member functions. Main program which performs the following: o Read the sides of triangles from an input file where every line contains the 3 sides of a triangle in the following order: a b c If any of the sides inputted is a negative number, throw an exception to change it to its positive form. o If it is not a right triangle, throw an exception object and output a warning to the user as shown on the sample run. Remember that you can check if it is a right triangle by applying the Pythagorean theorem: a + b = c Continue for all the input in the file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres the C program with exception handling to process right triang... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Give the best definition of Java and what it entails.

Answered: 1 week ago