HW3-A: Triangle Classifier Collapse context There are six types of triangles based on the lengths of their sides and the values of their angles. According to the lengths of the sides, triangles are classified into: equilateral (i.e. all sides have equal length), isosceles (i.e. two sides have equal length), and scalene (i.e. each side has different length). According to the values of the angles, triangles are classified into: right (i.e. one angle is 90 degrees and each of the other two angles is less than 90), acute (i.e. every angle is less than 90 degrees), and obtuse (i.e. one angle is greater than 90 degree and each of the other two angles is less than 90). It is important to consider the following notes: • The sum of the three triangle angles must always be 180 degrees. • A triangle belongs to only one category from each group. For example, a triangle can be scalene and acute or isosceles and right. The three angles of an equilateral triangle are always 60 degrees. . If the long side of the triangle is c and the other two sides are a and b, then: The triangle is right if c²= a² + b² o The triangle is acute if c² a² + b² You are asked to write a program in which the user inserts the lengths of any triangle's three sides. Based on the inserted values, the code outputs a statment that states the triangle classification according to its sides followed by the triangle classfication according to its angles. Example: If 8, 9, and 3 are inserted as sides' lengths, the output will be: scalene obtuse This is because the three sides are diffent in their lengths and 92 8² +3² There are two special cases to consider in your code. Firstly, if one or more of the sides' lengths = 0. the output will be "Invalid". Secondly, if one or more of the sides' lengths <0, the code shall assume that the negative values are positive and give out a normal output.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter3: Understanding Structure
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question

please solve it, C++

Example: If 8, 9, and 3 are inserted as sides' lengths, the output will be: scalene obtuse
This is because the three sides are diffent in their lengths and 92 > 82 +3²
There are two special cases to consider in your code. Firstly, if one or more of the sides' lengths = 0, the output will be "Invalid". Secondly, if one or more of
the sides' lengths <0, the code shall assume that the negative values are positive and give out a normal output.
IMPORTANT NOTE
. Do not add any cout statements except for the final answer as specified above.
Do not add any unnecessary spaces and follow the same format regarding spaces and letters case.
Assume that the right angle takes the range between 89 to 91 degrees in order to avoid any rounding effects.
• You may add any libraries needed.
•
●
1/0
Program Input:
Three double values that represent the sides' lengths of a triangle
Program Output:
Triangle classification based on sides then classification based on angles separated by a single space
Transcribed Image Text:Example: If 8, 9, and 3 are inserted as sides' lengths, the output will be: scalene obtuse This is because the three sides are diffent in their lengths and 92 > 82 +3² There are two special cases to consider in your code. Firstly, if one or more of the sides' lengths = 0, the output will be "Invalid". Secondly, if one or more of the sides' lengths <0, the code shall assume that the negative values are positive and give out a normal output. IMPORTANT NOTE . Do not add any cout statements except for the final answer as specified above. Do not add any unnecessary spaces and follow the same format regarding spaces and letters case. Assume that the right angle takes the range between 89 to 91 degrees in order to avoid any rounding effects. • You may add any libraries needed. • ● 1/0 Program Input: Three double values that represent the sides' lengths of a triangle Program Output: Triangle classification based on sides then classification based on angles separated by a single space
HW3-A: Triangle Classifier
Collapse context
There are six types of triangles based on the lengths of their sides and the values of their angles. According to the lengths of the sides, triangles are classified
into: equilateral (i.e. all sides have equal length), isosceles (i.e. two sides have equal length), and scalene (i.e. each side has different length). According to
the values of the angles, triangles are classified into: right (i.e. one angle is 90 degrees and each of the other two angles is less than 90), acute (i.e. every
angle is less than 90 degrees), and obtuse (i.e. one angle is greater than 90 degree and each of the other two angles is less than 90).
It is important to consider the following notes:
• The sum of the three triangle angles must always be 180 degrees.
●
A triangle belongs to only one category from each group. For example, a triangle can be scalene and acute or isosceles and right.
• The three angles of an equilateral triangle are always 60 degrees.
. If the long side of the triangle is c and the other two sides are a and b, then:
• The triangle is right if c² = a² + b²
o The triangle is acute if c² < a² +6²
The triangle is obtuse if c²> a² +6²
You are asked to write a program in which the user inserts the lengths of any triangle's three sides. Based on the inserted values, the code outputs a
statment that states the triangle classification according to its sides followed by the triangle classfication according to its angles.
Example: If 8, 9, and 3 are inserted as sides' lengths, the output will be: scalene obtuse
This is because the three sides are diffent in their lengths and 92 82 +32
There are two special cases to consider in your code. Firstly, If one or more of the sides' lengths = 0, the output will be "Invalid". Secondly, if one or more of
the sides' lengths <0, the code shall assume that the negative values are positive and give out a normal output.
S
FC
Su
Transcribed Image Text:HW3-A: Triangle Classifier Collapse context There are six types of triangles based on the lengths of their sides and the values of their angles. According to the lengths of the sides, triangles are classified into: equilateral (i.e. all sides have equal length), isosceles (i.e. two sides have equal length), and scalene (i.e. each side has different length). According to the values of the angles, triangles are classified into: right (i.e. one angle is 90 degrees and each of the other two angles is less than 90), acute (i.e. every angle is less than 90 degrees), and obtuse (i.e. one angle is greater than 90 degree and each of the other two angles is less than 90). It is important to consider the following notes: • The sum of the three triangle angles must always be 180 degrees. ● A triangle belongs to only one category from each group. For example, a triangle can be scalene and acute or isosceles and right. • The three angles of an equilateral triangle are always 60 degrees. . If the long side of the triangle is c and the other two sides are a and b, then: • The triangle is right if c² = a² + b² o The triangle is acute if c² < a² +6² The triangle is obtuse if c²> a² +6² You are asked to write a program in which the user inserts the lengths of any triangle's three sides. Based on the inserted values, the code outputs a statment that states the triangle classification according to its sides followed by the triangle classfication according to its angles. Example: If 8, 9, and 3 are inserted as sides' lengths, the output will be: scalene obtuse This is because the three sides are diffent in their lengths and 92 82 +32 There are two special cases to consider in your code. Firstly, If one or more of the sides' lengths = 0, the output will be "Invalid". Secondly, if one or more of the sides' lengths <0, the code shall assume that the negative values are positive and give out a normal output. S FC Su
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning