Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
What would be the best way to write this program?
Create a program that can determine the following facts about a triangle based on user input:
The user should select if they want to test based on angles or sides, then enter three values. The program should then return the results based on the user’s input.
Types of Triangles – Based on Angles
Right Triangle – At least one (1) interior angle is exactly 90°
Acute Triangle – All interior angles are less than 90°
Obtuse Triangle – At least one (1) interior angle is greater than 90°
Types of Triangles – Based on Sides
Equilateral Triangle –All sides must have the same length
Isosceles Triangle – At least two (2) sides are the same length
Scalene Triangle – All sides are unequal in length
The program should validate the triangle based on the following rules:
- The sum of the three angles should be 180
- The sum of any two sides must be greater than the length of the third side
My main thing is making the declarations. I can pretty much guide myself but instructor doesn't like the way my pseudocode turns out.
1 Answer
- 8 years agoFavorite Answer
Input:
Ask for user input A: Angles or B: Sides
input = Get User Input x3 (store in an array)
Validation:
sum the elements of the array, then run the sum through a switch statement or some other conditional
Functions:
checkRightTriangle(input)
return true/false;
checkAcuteTriangle(input)
return true/false
.....etc
Source(s): Software Engineer