PROGRAM #3: 30 points
• 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.
At a bare minimum, the program you submit must have the assigned source code, and your source code must compile and run without crashing.
• If you do not submit a zip file containing your source code (.java file), your score will be zero.
• If you submit source code that does not compile, your score will be zero.
• If you submit source code that roughly resembles the requirements and it compiles, but it crashes under normal operating conditions (nice input from the user), your score will be reduced by 75%.
• Deductions will be made for not meeting the usual requirements:
● Source code that is not formatted according to guidelines
● File and class names that do not meet specifications
Full credit No credit or Partial credit
Get console input
(8 points) Using a Scanner, the program obtains user input, formatted as specified Program does not use keyboard input, or uses it in a manner inconsistent with specifications
Compute Triangle measures
(14 points) Program correctly computes all mathematical measures There are mathematical errors in computation
Format console output
(8 points) Screen output is formatted as specified, using printf() statements, including converting vertex letters to uppercase Screen output does not match specifications
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:
• 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
● 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
Submit your Triangle.java source code file only.