# java小测试：回文测试、成绩判断、完全数判断、闰平年某月多少天、割绳子长短需多少天问题

package com.company;

import java.util.Scanner;

public class Test {
public static void main(String[] args) {
huiWenJundge(); //回文数字测试
finalNumsJundge();  //完全数判断
yearMonthJundge();  //闰月年，判断该年该月有多少天
stickLengthJundge();//设有一长度为3000m的绳子,每天减去一半,问需几天时间,绳子的长度会短于5m。要求用do…while结构实现

}

public static void stickLengthJundge() {
int stick=3000;
int i=0;

do{
stick=stick/2;
i++;

}while (stick>=5);
if(i>0){
System.out.println("总共需要"+i+"天,"+"绳子的长度会小于5米");
}
}

public static void yearMonthJundge() {
int days=0;
System.out.println("请先输入任意一个年份，再输入任意一个月份：");
Scanner input=new Scanner(System.in);
int year=input.nextInt();
int month=input.nextInt();
switch (month){
case 2:
if(year%4==0){
days=29;
break;
}
else {
days=28;
break;
}

case 4:
case 6:
case 9:
case 11:
days=30;
break;
default:
days=31;
}
System.out.println(year+"年"+month+"月有"+days+"天");
}

private static void finalNumsJundge() {
int sum = 1;
System.out.println("请输入一个整数：");
Scanner input = new Scanner(System.in);
int n = input.nextInt();
for (int i = 2; i < n; i++) {
if (n % i == 0)
sum += i;
}
if (sum == n) {
System.out.println(n + "是完全数");
} else
System.out.println(n + "不是完全数");
}

System.out.println("请输入一个分数（0~100）：");
Scanner input=new Scanner(System.in);
int stuScore=input.nextInt();
switch(stuScore/10){
case 10:
case 9:
break;
case 8:
break;
case 7:
case 6:
break;
default:

}
}

private static void huiWenJundge() {
int num1;
System.out.println("亲，请输入一个回文数，我们将对您的输入做检测：");
Scanner input=new Scanner(System.in);
num1=input.nextInt();
int ownNum=num1;
int newNum = 0;

while(ownNum!=0){
newNum=newNum*10;	//乘数
newNum+=ownNum%10;
ownNum/=10;
}
if(newNum==num1){
System.out.println("此数"+num1+"为回文数");
}
else{
System.out.println("此数"+num1+"不是回文数");
}
}
}



04-05 1319
01-11 267
06-19 1326
09-08 4416
03-14 3456
01-19 809
03-17 1万+
10-18 2万+
05-26 2044
07-30 1558
07-29 7477
08-31 1087
09-20 8607
12-26 3022
08-03 6193
02-02 1735