帮忙将这个判断三角形的形状程序设计一个测试程序

来源:互联网 发布:网络兼职有没有真的 编辑:程序博客网 时间:2024/04/29 06:44

 import java.util.*;
class Hu
{  int a;
   int b;
   int c;
   void judge()
   {
    Scanner in = new Scanner(System.in);
   System.out.println("请输入三角形的三边a,b,c。");
  a = in.nextInt();
  b = in.nextInt();
  c = in.nextInt();
  if(a<0||a>100||b<0||b>100||c<0||c>100)
   System.out.println("不满足条件");
  else if((a+b)<=c||(b+c)<=a||(a+c)<=b)
   System.out.println("不是三角形");
  else if(a==b&&b==c&&c==a)
   System.out.println("三角形是等边三角形");
   else if(a==b||b==c||c==a)
 System.out.println("三角形是等腰三角形");
   else
    System.out.println("三角形是一般三角形");
   
   }
 }
public class triangle {

 public static void main(String[] args) {
  Hu che = new Hu();
  che.judge();
 }

}