CS 1073 Introductory Programming
|
Use simple assignment statements to determine these values.
Print the six values that were input.
Print the values of these three sides.
Note: to interchange the values a, and c, use the statements:
Print the rearranged values of these three sides.
Print a message in case of a degenerate triangle.
Then execute System.exit(1) to quit the program.
Note: arccos in Java is Math.acos
Print the values of these three angles in degrees.
(Must multiply by 180/PI to convert radians to degrees.)
Print the value of the sum of these angles in degrees.
Print the value of this area.
Sample output (your output can be different, but you should have these values):
Vertices of triangle:
(2.0, 1.0), (6.0, 1.0), (6.0, 4.0)
Sides. a: 3.0, b: 4.0, c: 5.0
Angles. A: 36.86989764584401, B: 53.13010235415599, C: 90.0
Sum of angles in degrees: 180.0
Area: 5.999999999999998
(Here 5.196152422706632 is approximately 3*sqrt(3).)
Note: You should use netBeans, though it is permissible to use Java from another source. In netBeans, the simplest way to make up the material to print is to just copy from netBeans (using ctrl-C) and paste into Word or WordPad (using ctrl-V). Then print the resulting document.