学生成绩管理系统
public class MyPro {
public static void main(String[] args) {
//创建集合对象,用于存储学生数据
ArrayList<Student> array = new ArrayList<Student>();
Student stu[]= new Student[2];//学生对象数组
StudentInfo mis=new StudentInfo();
//用循环再次回到主界面
while (true) {
System.out.println(" ==============================================");
System.out.println(" 学生成绩管理系统 ");
System.out.println(" 1.录入学生的成绩信息");
System.out.println(" 2.显示学生的成绩信息");
System.out.println(" 3.计算学生的平均成绩");
System.out.println(" 4.显示学生的最高成绩");
System.out.println(" 5.按姓名查找学生信息");
System.out.println(" 6.修改学生的成绩信息");
System.out.println(" 7.按成绩排序学生信息");
System.out.println(" 8.按学号排序学生信息");
System.out.println(" 9.按姓名排序学生信息");
System.out.println(" 10.学生信息库扩容");
System.out.println(" 11.学生的成绩分段输出");
System.out.println(" 0.退出成绩管理系统");
System.out.println(" ==============================================");
System.out.println("请输入数字选项(0-11):");
//用Scanner实现键盘录入数据
@SuppressWarnings("resource") //忽略scanner的警告
Scanner sc = new Scanner(System.in);
String select = sc.nextLine();
switch (select) {
case "1":
System.out.println("========录入学生成绩信息========");
mis.addStudent(array);
break;
case "2":
System.out.println("========显示学生成绩信息========");
StudentInfo.findAllStudent(array);
break;
case "3":
System.out.println("========计算平均成绩========");
StudentInfo.aveScore(array);
break;
case "4":
System.out.println("========显示最高成绩========");
StudentInfo.maxScore(array);
break;
case "5":
System.out.println("========按姓名查找学生信息========");
StudentInfo.findName(array);
break;
case "6":
System.out.println("========修改学生成绩信息========");
StudentInfo.updateStudent(array);
break;
case "7":
System.out.println("========按成绩排序学生信息========");
StudentInfo.orderScore(array);
break;
case "8":
System.out.println("========按学号排序学生信息========");
StudentInfo.orderId(array);
break;
case "9":
System.out.println("========按姓名排序学生信息========");
StudentInfo.orderName(array);
break;
case "10":
System.out.println("========学生信息库扩容========");
stu = StudentInfo.expand(stu);
break;
case "11":
System.out.println("========学生成绩分段输出========");
StudentInfo.fenduan(array);
break;
case "0":
System.out.println("========退出管理系统========");
System.exit(0);
}
if(Student.getSum()==stu.length) {
stu = (Student[])array.toArray(new Student[array.size()]);
System.out.println("学生数量已达上限,请输入10进行数组扩容");
}
}
}
}
###运行截图