$29
Outcomes:
• Write programs that obtain user input.
• Write programs that compute mathematical results.
• Write programs that work with Strings.
• Write programs that display numbers formatted according to a given specification.
• Format and comment source code that adheres to a given set of formatting guidelines.
Preliminaries:
Before beginning to code, use the following website, https://www.mathsisfun.com/algebra/trig-finding-angle-right-triangle.html & https://everydaycalculation.com/right-triangle-calculator.php
to learn about properties of a right triangle. You need to learn to calculate the hypotenuse and angles from the sides. This will be useful as you code, because it will let you create triangles to test with your Java program.
Consider the following sketch:
Where:
• A, B, and C are the vertices of the right triangle.
• a,b, and c are the length of the sides of the right triangle.
• Notice that in the triangle ABC, x0 is the same as x1, and y0 is the same as y2.
• For this assignment, assume that x0, y0, x1, y1, x2, and y2 are positive numbers (they could be decimal numbers too) i.e. x00.0, y00.0, x10.0, y10.0, x20.0, and y20.0
Calculations:
• The above sketch shows a triangle ABC with three vertices A, B, and C; and the three coordinates of the three vertices.
• Given the coordinates for the vertices A and B, compute the following measures for the triangle ABC:
a. Find the coordinates of C.
b. Find the length of side a, b, and c.
c. Find the angle A, angle B and angle C.
d. Find the area, and perimeter of the triangle.
Your program should match this format as closely as possible.
Sample run 1:
Sample run 2:
Requirements: Your program should meet all the following requirements:
• The class name should be Triangle
• Prompt the user to enter the three-letter name of the triangle as a String. Each letter name is a vertex of the triangle. The user should type in this name as one String without any spaces.
• Prompt the user to enter the coordinates for vertex A (or its equivalent name) and vertex B (or its equivalent name) of a right triangle (given in order corresponding to the letters the user entered)
• When displaying the name of the vertices and angles, these need to be converted to uppercase.
• When displaying the name of the sides, these need to be converted to lowercase.
• Using System.out.printf(), display all the results of calculations for that triangle:
◦ A : (x2, y2) (or its equivalent name),
◦ B : (x1, y1) (or its equivalent name),
◦ C : (x0, y0) (or its equivalent name),
◦ Side a (or its equivalent name),
◦ Side b (or its equivalent name),
◦ Side c (or its equivalent name),
◦ Angle A (or its equivalent name),
◦ Angle B (or its equivalent name),
◦ Angle C (or its equivalent name),
◦ Perimeter, and
◦ Area
Submit your Triangle.java source code file only.