From a45c0b7fb087513e33ba396725e29d26c129412c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E5=9B=BD=E4=BA=AE?= <647597435@qq.com> Date: Wed, 21 Dec 2022 21:13:04 +0800 Subject: [PATCH] =?UTF-8?q?2022=2012=2021=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221221\344\275\234\344\270\232.md" | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 "19 \345\224\220\345\233\275\344\272\256/20221221\344\275\234\344\270\232.md" diff --git "a/19 \345\224\220\345\233\275\344\272\256/20221221\344\275\234\344\270\232.md" "b/19 \345\224\220\345\233\275\344\272\256/20221221\344\275\234\344\270\232.md" new file mode 100644 index 0000000..ee69670 --- /dev/null +++ "b/19 \345\224\220\345\233\275\344\272\256/20221221\344\275\234\344\270\232.md" @@ -0,0 +1,67 @@ +package 循环; + +import java.util.Scanner; + +public class H17 { +// 把扫描器放在最外层,让所有方法都可以用 + static Scanner sc =new Scanner(System.in); + public static void main(String[] args) { + String [] students =new String[10]; + students[0]="苏清华"; + students[1]="林佳泽"; + while (true){ + start(); + choicMenu(sc.nextInt(),students ,sc); + } + }public static void start (){ + System.out.println("-----------------------------"+ + "\n- 欢迎使用三班的学生管理系统-"+ + "\n- \t\t1.浏览所有学生信息\t\t-"+ + "\n- \t\t2.添加学生信息\t\t-"+ + "\n- \t\t3.修改学生信息\t\t-"+ + "\n- \t\t4.删除学生信息\t\t-"+ + "\n- \t\t5.查询学生信息\t\t-"+ + "\n- \t\t6.退出管理系统\t\t-"+ + "\n------------------------------"); + } + public static void choicMenu(int num,String[]stu,Scanner sc){ + switch (num){ + case 1: +// System.out.println("你选择了浏览学生信息"); + viewAllStuendt(stu); + break; + case 2: + addStudent(stu); +// System.out.println("你选择了添加学生信息"); + break; + case 3: + System.out.println("你选择了修改学生信息"); + break; + case 4: + System.out.println("你选择了删除学生信息"); + break; + case 5: + System.out.println("你选择了查询学生信息"); + + break; + case 6: + System.out.println("你选择了退出管理系统"); + break; + default: + System.out.println("选项错误"); + } + } + public static void viewAllStuendt(String[]stu){ + System.out.println("三班现有以下学生:"); + for (String name:stu){ + if (name==null){ + continue; + } + System.out.print(name+"\t"); + } + } + public static void addStudent(String[]stu){ + System.out.println("请输入你要添加的学生:"); + String name =sc.next(); + int index =searchIndex(stu,name); + if (index !=- \ No newline at end of file -- Gitee