package edu.course_text; import java.util.Scanner; public class System_stu { private static final int MaxNum=100; private static Score[] scoreStudent=new Score[MaxNum]; private static int numStudent=0; public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("*************************"); System.out.println("***欢迎使用学生成绩管理系统***"); System.out.println("*************************"); ABC: while(true){ System.out.println("以下是菜单栏"); System.out.println("1-查看、2-添加"); System.out.println("3-修改、4-删除"); System.out.println("5-统计、6-查找"); System.out.println("7-排序、0-退出"); System.out.println("请输入你的选项:"); String choose=sc.next(); switch (choose){ case "1" : displayScore();break; case "2" : AddScore(sc);break; case "3" : updateScore(sc);break; case "4" : deleteScore(sc);break; case "5" : sumScore(sc);break; case "6" : searchScore(sc);break; case "7" : sortScore(sc);break; case "0" : System.out.println("退出成功!");break ABC; default :System.out.println("没有此选项"); } } } private static void displayScore(){//查询 if(numStudent==0){ System.out.println("尚未添加学生,请返回菜单首页添加"); return; } System.out.println("下面为您展示学生成绩单"); System.out.println("序号\t\t学生姓名\t学生学号\t课程名称\t课程成绩"); for(int i=0;imax){ max=scoreStudent[i].score; } if(scoreStudent[i].score0 ; i--) { for(int j=0;jscoreStudent[j+1].score){ s=scoreStudent[j]; scoreStudent[j]=scoreStudent[j+1]; scoreStudent[j+1]=s; } } } System.out.println("展示排序后结果"); displayScore(); } } class Score{ int id;//序号 String stuName;//学生姓名 String stu_id;//学生学号 String scoreName;//课程名称 int score;//分数 public String toString(){ return "序号:"+id+",学号"+stu_id +",姓名:"+stuName+",课程名称:"+scoreName+",分数:"+score; } }