diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom01.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom01.java" new file mode 100644 index 0000000000000000000000000000000000000000..c51d14f6d795dd42cf33f8a24dcebbf2cf481a6d --- /dev/null +++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom01.java" @@ -0,0 +1,48 @@ +package lesson; + +import java.util.Scanner; + +public class Deom01 { + + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + System.out.println("请选择要计算的方法"); + String a =scan.next(); + System.out.println("请输入第一个数"); + int c =scan.nextInt(); + System.out.println("请输入第二个数"); + int b =scan.nextInt(); + switch (a) { + case "+": + System.out.println("返回的和是:"+jia(c,b)); + break; + case "-": + System.out.println("返回的差是:"+jian(c,b)); + break; + case "*": + System.out.println("返回的积是:"+cheng(c,b)); + break; + case "/": + System.out.println("返回的商是:"+chu(c,b)); + break; + default: + System.out.println("功能不足,没有这运算方法。"); + break; + } + } + + public static int jia(int c,int b) { + return c+b; + } + public static int jian(int c,int b) { + return c-b; + } + public static int cheng(int c,int b) { + return c*b; + } + public static int chu(int c,int b) { + return c/b; + } + } + + diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom02.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom02.java" new file mode 100644 index 0000000000000000000000000000000000000000..4fba00d8b0e49a652fd4bc881cf664c209b5344c --- /dev/null +++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom02.java" @@ -0,0 +1,21 @@ +package lesson; + +public class Deom02 { + + public static void main(String[] args) { + int [] nummax = {1,2,3,4,5}; + + int result = bigger(nummax); + + } + public static int bigger(int[] nummax) { + int max =nummax[0]; + for (int i = 1; i < nummax.length; i++) { + if(nummax[i]>max) { + max = nummax[i]; + } + } + return max; + } + +} diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom03.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom03.java" new file mode 100644 index 0000000000000000000000000000000000000000..d36f9f88e6d7e00e8171d1d1aa8b008b9df0ec0b --- /dev/null +++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\345\274\240\351\221\253/Deom03.java" @@ -0,0 +1,61 @@ +package lesson; + +import java.util.Scanner; + +public class Deom03 { + + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + System.out.println("请选择要计算的图像的面积"); + int a =scan.nextInt(); + System.out.println("1.长方形的面积"); + System.out.println("2.正方形的面积"); + System.out.println("3.三角形的面积"); + System.out.println("4.圆形的面积"); + switch (a) { + case 1: + System.out.println("请输入长"); + int c =scan.nextInt(); + System.out.println("请输入宽"); + int b =scan.nextInt(); + System.out.println("返回的长方形面积是:"+cfx(c,b)); + break; + case 2: + System.out.println("请输入边长"); + int d =scan.nextInt(); + System.out.println("返回的正方形面积是:"+zfx(d)); + break; + case 3: + System.out.println("请输入底"); + int e =scan.nextInt(); + System.out.println("请输入高"); + int f =scan.nextInt(); + System.out.println("返回的三角形面积是:"+sjx(e,f)); + break; + case 4: + System.out.println("请输入半径"); + double g =scan.nextDouble(); + System.out.println("返回的圆形面积是:"+yx(g)); + break; + default: + System.out.println("功能不足,没有。"); + break; + } + } + + public static int cfx(int c,int b) { + return c*b; + } + public static int zfx(int d) { + return d*d; + } + public static int sjx(int e,int f) { + return e*f/2; + } + public static double yx(double g) { + return g*g*3.14; + } + + + } +