3.完成一个学生管理系统功能如下
1.在控制台输入以下界面
“🌇🌙☀♥📕🌳 学生管理系统 🤺🏂🏊💃🏃🚶🌧🌨⛅🌂\r\n” +
“👇 1.添加学生 👇\r\n” +
“👇 2.查询所有的学生 👇\r\n” +
“👇 3.根据学号删除学生 👇\r\n” +
“☆ 4.批量添加 ★\r\n”+
“👆 5.批量删除 👆\r\n”+
“👆 6.修改学生信息(学号不能修改) 👆\r\n”+
“👆 7.根据名字搜索 👆\r\n”+
“🐱🐕🐅🦁🐟🐒🐉🐀🐂🐇🐍🐎🐏🐓🐖🦆🐻🦅🐜🐧”
根据不同的标号实现其功能
功能可以增加
注意:
添加学生时,如果学生的名字是"蒙鑫",给予特殊照顾,
无论学生成绩多差都需要排第一位
1、Student
@SuppressWarnings("rawtypes")
public class Student implements Comparable{
private long id;
private String name;
private double score;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + ", score=" + score + "]";
}
public Student(long id, String name, double score) {
this.id = id;
this.name = name;
this.score = score;
}
public Student() {
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
Student stu= (Student)o;
return (int)(stu.score-this.score);
}
}
2、Test
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class Test {
static int num =0;
static int temp =0;
@SuppressWarnings("rawtypes")
List list = new ArrayList();
public void choose() {
System.out.println();
System.out.println("功能选择:"+"\n输入esc退出程序");
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
String ss = scanner.next().toString();
if(ss.length()>3) {
System.out.println("输入有误,请重新输入\n");
choose();
}
if(ss.equals("esc")) {
System.out.println("bye");
}else if(ss.length()>1){
System.out.println("输入有误请重新输入");
choose();
}else {
try {
int a = Integer.parseInt(ss);
if(a==1