📄 traingle.java
字号:
import java.util.Scanner;
public class traingle extends graph {
traingle() {
System.out
.println("Please input offset about x & y:(notice: 以前两点构成的直线需存在斜率且不为0)");
Scanner in1 = new Scanner(System.in);
Scanner in2 = new Scanner(System.in);
Scanner in3 = new Scanner(System.in);
Scanner in4 = new Scanner(System.in);
Scanner in5 = new Scanner(System.in);
Scanner in6 = new Scanner(System.in);
double x, y, x1, y1, x2, y2;
x = in1.nextDouble();
y = in2.nextDouble();
x1 = in3.nextDouble();
y1 = in4.nextDouble();
x2 = in5.nextDouble();
y2 = in6.nextDouble();
System.out.println("construct completed");
System.out.println("This traingle info is:");
this.x0 = (x + x1 + x2) / 3;
this.y0 = (y + y1 + y2) / 3;
System.out.print("Area is: ");
mularea s = new mularea();
double l, h;
l = 0.5 * Math.hypot(x - x1, y - y1);
double a = (y - y1) / (x - x1);
double b = (x * y1 - x1 * y) / (x - x1);
h = Math.abs(a * x2 + b - y2) / Math.hypot(a, b);
System.out.println(s.area(l, h));
System.out.print("Girth is: ");
mulgirth c = new mulgirth();
System.out.println(c.girth(x, y, x1, y1, x2, y2));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -