SSS Triangle Lab
Ask the user for the side length of a triangle.
- Check if the sides can make a triangle. If they don't make a triangle, let the user know.
- If the sides can make a triangle, classify the triangle two different ways:
- By its sides: is the triangle equilateral, isosceles, or scalene ?
- By its angles: is the triangle right, obtuse, or acute ?
- Bonus: Report the area of the triangle.
- Double Bonus: Report all the measure of the angle in the triangle. Research law of cosines for this task.
- When done, ask whether the user wants to run the code again. If they say no, stop the program. If they say anything else, run the program again.
- BEFORE YOU CODE, you must create pseudo-code!
If you get stuck:
The converse of the Pythagorean Theorem will help you classify a triangle by its angles.
Test Input and Output
Sample Below:
Input:
Please give me three numbers representing the side lengths of a triangle.
Enter the shortest side: 3
Enter the second shortest side: 4
Enter the longest side: 5
Output:
Perimeter of the triangle is 12
This is a scalene right triangle.
BONUS! The area of this triangle is 6 square units.
DOUBLE BONUS!! This triangle has angle measures of 90.0, 53.13040235415599, and 36.86989764584 degrees.
Due Friday February 1, 2019:
Lab 2.5 Triangle Lab
- 4 Snakify problems mentioned in previous blog post.
- Read Section 2.4 List is a Sequence of Values
No comments:
Post a Comment