Write a C++ program with exception handling to process right triangles which includes the following: A...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Heres the C program with exception handling to process right triang... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Use the approximations obtained in Exercise 3 to approximate the following integrals, and compare your results to the actual values. a. b. c. d. (cos --2 sin ) dr (x cos x2 + er cos ex) dx
-
Volusia Company reported the following comparative balance sheets for 2019: Volusia Company Balance Sheet December 31, 2018 and 2019 Additional Information: 1. Net income for 2019 was $18,300. 2....
-
Develop another plan for the Mexican roofing manufacturer described in Examples 1 to 4 ( pages 526 530) and Solved Problem 13.1 ( pages 540 541). a) For this plan, plan 5, the firm wants to maintain...
-
With reference to Exercise 3.1, suppose that the points \((0,0),(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(1,3)\), \((2,0),(2,1),(2,2),(2,3),(3,0),(3,1),(3,2)\), and \((3,3)\) have the probabilities...
-
For the following situations, would you collect information using a sample or a population? Why? a. Statistics 201 is a course taught at a university. Professor Rauch has taught nearly 1,500 students...
-
Which job does supportive equity play in compromise, especially in cases including damage or bad behavior, and how might helpful cycles cultivate responsibility, mending, and compromise among...
-
What is the subject matter of each of the following TAM? a. TAM 200703019 b. TAM 201734007 c. TAM 9853001
-
When you listen to others' stories, do you evaluate them based on coherence and fidelity? Can you think of any other criteria that you use to evaluate the stories that you hear? Book: Introducing...
-
The marginal cost curve intersects the average variable cost curve at the ______. a) shut-down point b) break-even point c) maximum profi t point
-
During a very bad recession the nations disposable income fell by 10 percent, while its consumption of a certain good rose by 5 percent. That good was _______good. a) a complementary b) a substitute...
-
Can more than one of the four main approaches to job design be used at the same time to design a job? Can you provide an example of how this could work?
-
Which statement is false? a) AFC plus AVC equals ATC. b) Marginal cost equals AVC at an output of one. c) AVC equals ATC at an output of one. d) None of the above.
-
A firm seeking to maximize its total revenue would lower its price until price elasticity of demand was ______. a) a maximum b) a minimum c) one
-
Yes No Evidence or example Recommendations Example: Does your organization include DE&I practices in its mission and vision? X The mission and vision do not address DE&I. In order to...
-
Floyd Distributors, Inc., provides a variety of auto parts to small local garages. Floyd purchases parts from manufacturers according to the EOQ model and then ships the parts from a regional...
-
Ulysses and Penelope are married and file separate returns for 2012. Penelope itemizes her deductions on her return. Ulysses' adjusted gross income was $17,400, his itemized deductions were $2,250,...
-
Linda and Richard are married and file a joint return for 2012. During the year, Linda, who works as an accountant for a national airline, used $2,100 worth of free passes for travel on the airline;...
-
Sherry Hopson owns a retail family clothing store. Her store is located at 4321 Circle Drive, Houston, TX 77001. Her employer identification number is 95- 1234321 and her Social Security number is...
-
What is the change in value for this security over the four quarters recorded in the highlowclose graph?
-
Which of the 10 years had the most and least variability between the maximum sales of womens clothing and the minimum for mens, and what were those ranges?
-
What happened to the average sales figures for jewelry over the 10-year period?
Study smarter with the SolutionInn App