第三次java作业

package test3;
import java.util.*;
public class abc {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  System.out.println("请输入年份,判断是否为闰年");

Scanner input=new Scanner(System.in);
int a = input.nextInt();
  if(a%4==0&&a%4!=0) {
   System.out.println("是润年");
  }else if(a%400==0) {
   System.out.println("是润年");
  }else {
  System.out.println("不是闰年");
 }
 }
package test3;
import java.util.*;
public class abc{
 public static void main(String[] args) {
  System.out.println("输入四位卡号,可以判断幸运会员");
  Scanner input=new Scanner(System.in);
  int a = input.nextInt();
  if(a/100%10%3==0) {
   System.out.println("幸运会员");
  }else System.out.println("您不幸运会员");
 }
}
package test3;
import java.util.*;
public class abc{
public static void main(String[] args) {
 System.out.println("输入x的值,输出y值");
  Scanner input = new Scanner(System.in);
  double x=input.nextDouble();
  double y;
  if(x>0) {
   y=x+3;
   System.out.println("y值为"+y);
  }else if(x==0) {
   y=x;
   System.out.println("y值为"+y);
  }else if(x<0) {
   y=2*x-1;
   System.out.println("y值为"+y);
  }
   
}
}
package test3;
import java.util.*;
public class abc{
public static void main(String[] args) {
 System.out.println("输入三个数,判断能否构成三角形");
  Scanner input = new Scanner(System.in);
  double a=input.nextDouble();
  double b=input.nextDouble();
  double c=input.nextDouble();
  if(a+b>c) {
   if(a+c>b) {
    if(b+c>a) {
     System.out.println("YES");
    }
   }
   else {
    System.out.println("NO");
   }
  }else {
   System.out.println("NO");
  }
  
   
}
}

 

posted @ 2020-03-24 11:00  啪啪怪  阅读(181)  评论(0编辑  收藏  举报