diff --git "a/08 \350\224\241\346\263\275\351\222\246/20221216\346\226\271\346\263\225\347\232\204\351\207\215\350\275\275.md" "b/08 \350\224\241\346\263\275\351\222\246/20221216\346\226\271\346\263\225\347\232\204\351\207\215\350\275\275.md" index 3de14257974416450d22ff356c2797c710e85d04..27423112dbe0f624960f8ca411894fcc3f7c2708 100644 --- "a/08 \350\224\241\346\263\275\351\222\246/20221216\346\226\271\346\263\225\347\232\204\351\207\215\350\275\275.md" +++ "b/08 \350\224\241\346\263\275\351\222\246/20221216\346\226\271\346\263\225\347\232\204\351\207\215\350\275\275.md" @@ -178,11 +178,11 @@ public static void main(String[] args) { } public static void getS(double a){ double b = a*a; - System.out.println("这个圆的的面积为"+ b +"π"); + System.out.println("这个圆的的面积为"+ b +3.14); } public static void getL(double a){ double b = a*2; - System.out.println("这个圆的周长为"+ b +"π"); + System.out.println("这个圆的周长为"+ b +3.14); } ~~~ diff --git "a/08 \350\224\241\346\263\275\351\222\246/20221220 \345\255\246\347\224\237\347\263\273\347\273\237\351\241\271\347\233\256.md" "b/08 \350\224\241\346\263\275\351\222\246/20221220 \345\255\246\347\224\237\347\263\273\347\273\237\351\241\271\347\233\256.md" new file mode 100644 index 0000000000000000000000000000000000000000..eb7fc87d6849d924eb044b45ee5fbd3dda0e69ca --- /dev/null +++ "b/08 \350\224\241\346\263\275\351\222\246/20221220 \345\255\246\347\224\237\347\263\273\347\273\237\351\241\271\347\233\256.md" @@ -0,0 +1,92 @@ +### 1.项目 +~~~java + // ============================== + // - 欢迎使用3班学生管理系统 - + // - 1.浏览所有学生信息 - + // - 2.添加学生信息 - + // - 3.修改学生信息 - + // - 4.删除学生信息 - + // - 5.查询学生信息 - + // - 6.退出管理系统 - + // ============================== + //请输入对应的数字选择你需要的功能: + static Scanner sc=new Scanner(System.in);//静态扫描器。共用的 + public static void main(String[] args) { + String[]students = new String[10]; + students[0]="1号"; + students[1]="2号"; + students[2]="3号"; + students[3]="4号"; + students[4]="5号"; + students[5]="6号"; + welcome(); + Scanner sc =new Scanner(System.in); + xt(sc.nextInt(),students); + + } + public static void xt(int num ,String[] stu){ + switch(num){ + case 1: + System.out.println("打印所有学生的信息"); + sy(stu); + break; + case 2: + tj(stu); + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + default: + System.out.println("请输入正确的数字服务"); + } + } + public static void welcome(){ + System.out.println("==============================\n" + + " // - 欢迎使用3班学生管理系统 -\n" + + " // - 1.浏览所有学生信息 -\n" + + " // - 2.添加学生信息 -\n" + + " // - 3.修改学生信息 -\n" + + " // - 4.删除学生信息 -\n" + + " // - 5.查询学生信息 -\n" + + " // - 6.退出管理系统 -\n" + + " // ==============================\n" + + " //请输入对应的数字选择你需要的功能:"); + } + //1.浏览所以学生信息 + public static void sy(String[] stu){ + System.out.println("有以下全部信息"); + for (String name:stu) { + if (name!= null) { + System.out.print(name+"\t "); + } + } + } + //2.添加学生信息 + public static void tj(String[] stu){ + System.out.println("添加学生信息"); + String name = sc.next(); + int index = xg(stu,null); + if(index==-1){ + System.out.println("找不到"); + }else { + System.out.println("在"+index+"位置"); + } + + + } + public static int xg(String[] stu,String[] str){ + int index = -1;//数组里0表示第一个元素。-1表示不存在 + for (int i =0;i< stu.length;i++){ + if (str.equals(stu[i])){ + index=i; + return index; + + } + } + return index; + } \ No newline at end of file