📄 tr.java
字号:
import java.io.*;
import java.lang.*;
class triangle
{
double b,ht,hy;
int a1,a2,a3;
triangle(int x,int y,int z)
{
a1=x;
a2=y;
a3=z;
}
triangle(double x,double y,double z)
{
b=x;
ht=y;
hy=z;
}
void triarea()
{
double a;
a=0.5*(b+ht);
System.out.println("area of triangle:"+a);
}
void triperi()
{
double c;
c=(b+ht+hy);
System.out.println("perimeter of triangle:"+c);
}
void isos()
{
if(b==ht||b==hy)
System.out.println("triangle is isosceles");
else if(ht==hy)
System.out.println("triangle is isosceles");
else
System.out.println("triangle is not isosceles");
}
void right()
{
if(a1==90||a2==90||a3==90)
System.out.println("triangle is right angled");
else
System.out.println("triangle is not right angled");
}
}
class tr
{
public static void main(String arg[])throws Exception
{
triangle o1=new triangle(4.3,5.0,2.0);
triangle o2=new triangle(30,60,90);
o1.triarea();
o1.triperi();
o1.isos();
o2.right();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -