diff --git "a/33 \346\235\216\345\245\211\345\275\254/20230328 \347\273\203\344\271\2401.txt" "b/33 \346\235\216\345\245\211\345\275\254/20230328 \347\273\203\344\271\2401.txt" new file mode 100644 index 0000000000000000000000000000000000000000..6caeb4158365f9a086506e05d56f2d10d1c8cdcc --- /dev/null +++ "b/33 \346\235\216\345\245\211\345\275\254/20230328 \347\273\203\344\271\2401.txt" @@ -0,0 +1,62 @@ +public class Demo01 { +public static void main(String[] args) { +//1.定义父亲身高 +double father = 177; + +//2.定义母亲身高 +double mother = 165; + +//3.利用公式计算儿子身高 +double son = (father + mother) * 1.08 / 2; + +//4.利用公式计算女儿身高 +double daughter = (father * 0.923 + mother) / 2; + +//5.打印结果 +System.out.println("儿子预计身高" + son + "厘米"); +System.out.println("女儿预计身高" + daughter + "厘米"); + + } +} + + +public class Demo2 { +public static void main(String[] args) { +//1.定义红茶妹妹原来的钱 +int red = 21; + +//2.定义绿茶妹妹原来的钱 +int green = 24; + +//3.求红茶妹妹现有的钱 +red = red * 2 + 3; + +//4.求绿茶妹妹现有的钱 +green *= 2; + +//5.判断并输出两个人的钱是否相等 +System.out.println(red == green); + + } + } + + +public class Demo3 { +public static void main(String[] args) { +//1.求不使用优惠时的总价 +double money1 = 24 + 8 + 3; + +//2.判断折后总价 +money1 = (money1 >= 30 ? money1 : money1 * 0.8); + +//3.求使用优惠时的总价 +double money2 = 16 + 8 + 3; + +//4.判断两种花费哪个更少 + +double money = money1 < money2 ? money1 : money2; +//5.打印最终花费 + +System.out.println(money); + } + } diff --git "a/33 \346\235\216\345\245\211\345\275\254/20230328 \350\277\220\347\256\227\347\254\246\344\275\234\344\270\232.txt" "b/33 \346\235\216\345\245\211\345\275\254/20230328 \350\277\220\347\256\227\347\254\246\344\275\234\344\270\232.txt" new file mode 100644 index 0000000000000000000000000000000000000000..862fd1dc992ee3868b101a07db18e239f03703d6 --- /dev/null +++ "b/33 \346\235\216\345\245\211\345\275\254/20230328 \350\277\220\347\256\227\347\254\246\344\275\234\344\270\232.txt" @@ -0,0 +1,88 @@ +import java.util.Scanner; +public class Main { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + char b =sc.nextLine().charAt(0); + char a ='1'; + if (b>='0'& b<='9'){ + System.out.println("true"); + }else{ + System.out.println("false"); + } + + } +} + +import java.util.Scanner; +public class work1 { + public static void main(String[] args) { + { + Scanner ax =new Scanner(System.in); + char c =ax.nextLine().charAt(0); + char d = 'C'; + if(c>='a'&d<='z'| c>='A'&d<='Z'){ + System.out.println("true"); + }else { + System.out.println("false"); + } + } + } +} + +import java.util.Scanner; +public class work2 { + public static void main(String[] args) { + Scanner sc =new Scanner(System.in); + System.out.println("请输入年份"); + int a =sc.nextInt(); + if(a%4==0&&a%100 !=0|| a%400==0){ + System.out.println(a+"年为闰年"); + }else{ + System.out.println(a+"年不是闰年"); + } + } +} + +import java.util.Scanner; +public class work3 { + public static void main(String[] args) { + Scanner sc =new Scanner(System.in); + System.out.println("请输入一个三位数:"); + int a = sc.nextInt(); + int b=a/100; + int c=a%100/10; + int d=a%10; +if(a>=100 && a<= 1000){ + if(b*b*b+c*c*c+d*d*d==a) + System.out.println(a+"是水仙花数"); +}else{ + System.out.println(a+"不是水仙花数"); + } + } +} + + +import java.util.Scanner; +public class work4 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("输入一个五位数"); + int num = sc.nextInt(); + //拆分五位数的位数 + int g = num%10; + int s = num/10%10; + int b = num/100%10; + int q = num/1000%10; + int w = num/10000; + + //进行个位与万位,十位与千位的比较 + if (g == w && s == q){ + System.out.println(num + "是回文数字"); + }else { + System.out.println(num + "不是回文数字"); + + } + + } +} +