forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputeAngles.java
More file actions
executable file
·46 lines (44 loc) · 1.63 KB
/
ComputeAngles.java
File metadata and controls
executable file
·46 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* */ package ch04;
/* */
/* */ import java.util.Scanner;
/* */
/* */ public class ComputeAngles {
/* */ public static void main(String[] args) {
/* 7 */ Scanner input = new Scanner(System.in);
/* */
/* */
/* 10 */ System.out.print("Enter three points: ");
/* 11 */ double x1 = input.nextDouble();
/* 12 */ double y1 = input.nextDouble();
/* 13 */ double x2 = input.nextDouble();
/* 14 */ double y2 = input.nextDouble();
/* 15 */ double x3 = input.nextDouble();
/* 16 */ double y3 = input.nextDouble();
/* */
/* */
/* 19 */ double a = Math.sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
/* */
/* 21 */ double b = Math.sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
/* */
/* 23 */ double c = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
/* */
/* */
/* */
/* 27 */ double A = Math.toDegrees(Math.acos((a * a - b * b - c * c) / -2.0D * b * c));
/* */
/* 29 */ double B = Math.toDegrees(Math.acos((b * b - a * a - c * c) / -2.0D * a * c));
/* */
/* 31 */ double C = Math.toDegrees(Math.acos((c * c - b * b - a * a) / -2.0D * a * b));
/* */
/* */
/* */
/* 35 */ System.out.println("The three angles are " + (
/* 36 */ Math.round(A * 100.0D) / 100.0D) + " " + (
/* 37 */ Math.round(B * 100.0D) / 100.0D) + " " + (
/* 38 */ Math.round(C * 100.0D) / 100.0D));
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch04/ComputeAngles.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/