第二次结对编程作业——毕业导师智能匹配

Posted on 2016-09-30 21:22  yzlsj  阅读(378)  评论(2编辑  收藏  举报

031402612李坤隆

031402629张建华

要求

输入(程序随机生成)

  1. 30个老师(包含学生上限)和100个学生(包含绩点)

  2. 每个学生5个志愿导师

  3. 导师可以带不大于其要求上限的学生数

输出

  1. 导师学生间的匹配信息

  2. 未被分配到学生的导师

  3. 未被导师选中的学生

实现方案

  1. 采用mysql存取数据

  2. 使用java编写程序

实现算法

流程图

数据库字段描述

  1. 学生表

一开始想太多设计了一些多余的字段

学生表

  • id为该学生的唯一标识
  • mentor 为导师的id
  • gpa 为绩点信息
  1. 导师表

有一些多余字段

导师表

  • id唯一标识一个导师

  • stu_num为导师设置的希望招生数

  • accepted_stu_num 为导师已同意的申请数

  • final_stu_num 为导师最终招到的学生数

  1. 志愿表

志愿表

  • id 为学生的id

  • w1-w5为志愿1-志愿5(值为导师的id)

  • w1_statu-w5_statu为志愿1-志愿5当前的状态,0表示已被拒绝, 1表示已被同意

  1. 导师所带学生表

导师-学生表

  • id 为导师id

  • stu1-stu8 为学生1-学生8的id,若没有则为空

相关代码段

  1. 主函数
public static void main(String[] args) {
		//导师分配三步走
		MentorDistribution mentorDistribution = new MentorDistribution();
		/*
		 * 第一步,对所有学生进行分配,若只有一个老师同意则直接分配,若多个老师同意则分配给志愿最高的老师,
		 * 没有老师同意的留到第二次分配(满足老师与学生双向互选的需求)
		 */
		mentorDistribution.firstStep();
		/*
		 * 第二步,对剩余学生按绩点进行排序,从第一个学生开始,依次检索第1-5志愿导师,若有导师招生未满则分配给
		 * 该导师(满足绩点优先的需求)
		 */
		mentorDistribution.secondeStep();
		/*
		 * 第三步,对老师按已经招收的学生数进行排序(优先分配给已招生数较少的老师),将剩余学生依次分配给
		 * 尚未招满的老师(满足分配尽量平均的需求)
		 */
		mentorDistribution.thirdStep();
		//获取每个导师带的学生数据
		List<StuOfMentor> stuOfMentors = mentorDistribution.getMentorStudents();
		//将结果存入数据库
		DBUtils.getInstance().insertStuOfMentors(stuOfMentors);
		System.out.println("--------------end--------------");
		
	}
  1. MentorDistribution类
public class MentorDistribution {
	//数据库工具类
	private DBUtils dbUtils;
    //Wish为志愿类
	private List<Wish> wishes;
	
	public  MentorDistribution() {
		dbUtils = DBUtils.getInstance();
		wishes = dbUtils.getWishes();
	}
	/*
	 * 第一步,对所有学生进行分配,若只有一个老师同意则直接分配,若多个老师同意则分配给志愿最高的老师,
	 * 没有老师同意的留到第二次分配(满足老师与学生双向互选的需求)
	 */
	
	public void firstStep() {
		int finalStuNum;
        //遍历每个学生的志愿
		for(Wish wish : wishes){
			if(wish.getW1_statu() == 1){
                //将学生的导师id存入数据库
				dbUtils.setMentor(wish.getId(), wish.getW1());
                //老师已招生数加1
				finalStuNum = dbUtils.getFinalStuNum(wish.getW1()) + 1;
                //更新老师已招生数
				dbUtils.setFinalStuNum(wish.getW1(), finalStuNum);
			}else if(wish.getW2_statu() == 1){
				dbUtils.setMentor(wish.getId(), wish.getW2());
				finalStuNum = dbUtils.getFinalStuNum(wish.getW2()) + 1;
				dbUtils.setFinalStuNum(wish.getW2(), finalStuNum);
			}else if(wish.getW3_statu() == 1){
				dbUtils.setMentor(wish.getId(), wish.getW3());
				finalStuNum = dbUtils.getFinalStuNum(wish.getW3()) + 1;
				dbUtils.setFinalStuNum(wish.getW3(), finalStuNum);
			}else if(wish.getW4_statu() == 1){
				dbUtils.setMentor(wish.getId(), wish.getW4());
				finalStuNum = dbUtils.getFinalStuNum(wish.getW4()) + 1;
				dbUtils.setFinalStuNum(wish.getW4(), finalStuNum);
			}else if(wish.getW4_statu() == 1){
				dbUtils.setMentor(wish.getId(), wish.getW5());
				finalStuNum = dbUtils.getFinalStuNum(wish.getW5()) + 1;
				dbUtils.setFinalStuNum(wish.getW5(), finalStuNum);
			}else{
				continue;
			}
		}
	}
	/*
	 * 第二步,对剩余学生按绩点进行排序,从第一个学生开始,依次检索第1-5志愿导师,若有导师招生未满则分配给
	 * 该导师(满足绩点优先的需求)
	 */
	public void secondeStep() {
        //从数据库获取学生信息
		List<Student> students = dbUtils.getStudents();
		Collections.sort(students);
		for(Student student : students){
			int id = student.getId();
			Wish wish = null;
			//获取该学生志愿
			for(Wish w : wishes){
				if(w.getId() == id){
					wish = w;
					break;
				}
			}
			int finalStuNum;
			int stuNum;
			//获取志愿一至五的导师ID
			List<Integer> mtIds = new ArrayList<>();
			mtIds.add(wish.getW1());
			mtIds.add(wish.getW2());
			mtIds.add(wish.getW3());
			mtIds.add(wish.getW4());
			mtIds.add(wish.getW5());
			for(int mtId : mtIds){
				//获取已经招收的学生数和导师设置的希望的招生数
				finalStuNum = dbUtils.getFinalStuNum(mtId);
				stuNum = dbUtils.getStuNum(mtId);
                //判断导师招生数是否已满,未满则分配给该导师
				if(stuNum > finalStuNum){
					dbUtils.setMentor(student.getId(), mtId);
					finalStuNum = finalStuNum + 1;
					dbUtils.setFinalStuNum(mtId, finalStuNum);
					break;
				}
			}			
			
		}
	}
	
	/*
	 * 第三步,对老师按已经招收的学生数进行排序(优先分配给已招生数较少的老师),将剩余学生依次分配给
	 * 尚未招满的老师(满足分配尽量平均的需求)
	 */
	public void thirdStep() {
		//获取导师和学生信息
		List<Mentor> mentors = dbUtils.getMentors();
		List<Student> students = dbUtils.getStudents();
		for(Student student : students){
			//对导师按已招生数进行排序
			Collections.sort(mentors);
			for(Mentor mentor : mentors){
				int stuNum = mentor.getStuNum();
				int finalStuNum = mentor.getFinalStuNum();
				//若已招收的人数比导师设置的希望招生数小,则分配该学生给该导师
				if(finalStuNum < stuNum){
					dbUtils.setMentor(student.getId(), mentor.getId());
					dbUtils.setFinalStuNum(mentor.getId(), (mentor.getFinalStuNum()+1));
					mentor.setFinalStuNum(mentor.getFinalStuNum()+1);
					break;
				}
			}
		}
	}
    //从数据库的学生表获取学生的导师数据,整理输出到数据库的导师所带学生表
	public List<StuOfMentor> getMentorStudents() {
		List<Student> students = dbUtils.getAllStudents();
        //StuOfMentor为导师所带学生类(对应数据库的导师所带学生表)
		List<StuOfMentor> stuOfMentors = new ArrayList<StuOfMentor>();		
		for(int i = 1;i < 31;i++){
			StuOfMentor stuOfMentor = new StuOfMentor(i);
			for(Student student : students){				
				if(student.getMentorId() == i){
					//如果该学生是导师i的学生,则将他添加到该导师的学生列表中
					stuOfMentor.addStuId(student.getId());
				}
			}
			stuOfMentors.add(stuOfMentor);
		}
		return stuOfMentors;
	}
}

测试数据及结果

输入数据

  1. 学生数据
+----+------+
| id | gpa  |
+----+------+
|  0 | 0.28 |
|  1 | 3.14 |
|  2 |  4.1 |
|  3 | 4.84 |
|  4 | 3.09 |
|  5 | 1.92 |
|  6 | 1.55 |
|  7 | 3.51 |
|  8 | 0.41 |
|  9 | 0.31 |
| 10 | 2.08 |
| 11 |    1 |
| 12 | 4.17 |
| 13 | 2.61 |
| 14 | 4.23 |
| 15 | 4.14 |
| 16 | 3.73 |
| 17 | 0.37 |
| 18 | 2.21 |
| 19 |  3.8 |
| 20 | 0.02 |
| 21 | 2.84 |
| 22 | 3.64 |
| 23 | 0.72 |
| 24 | 2.09 |
| 25 | 3.12 |
| 26 |  2.8 |
| 27 |  2.4 |
| 28 | 3.83 |
| 29 | 3.89 |
| 30 | 4.72 |
| 31 | 2.74 |
| 32 |  3.4 |
| 33 | 2.71 |
| 34 | 4.95 |
| 35 | 3.93 |
| 36 | 2.53 |
| 37 | 2.89 |
| 38 | 0.34 |
| 39 | 0.45 |
| 40 | 0.82 |
| 41 |  1.9 |
| 42 | 2.93 |
| 43 | 3.17 |
| 44 |  2.2 |
| 45 |  0.7 |
| 46 | 2.78 |
| 47 | 2.34 |
| 48 | 1.71 |
| 49 | 3.75 |
| 50 | 4.86 |
| 51 | 1.62 |
| 52 | 0.57 |
| 53 | 1.16 |
| 54 | 1.76 |
| 55 | 1.21 |
| 56 | 1.26 |
| 57 | 1.13 |
| 58 | 1.32 |
| 59 | 2.22 |
| 60 | 2.03 |
| 61 | 2.71 |
| 62 | 2.17 |
| 63 | 0.41 |
| 64 | 1.83 |
| 65 | 1.12 |
| 66 | 0.89 |
| 67 | 1.63 |
| 68 | 1.99 |
| 69 | 0.02 |
| 70 | 1.07 |
| 71 | 3.11 |
| 72 | 0.58 |
| 73 | 2.37 |
| 74 | 2.65 |
| 75 | 3.71 |
| 76 | 3.51 |
| 77 | 4.47 |
| 78 | 4.92 |
| 79 | 3.68 |
| 80 | 3.67 |
| 81 | 4.85 |
| 82 |  2.2 |
| 83 | 3.84 |
| 84 | 0.46 |
| 85 | 3.31 |
| 86 | 3.83 |
| 87 | 1.44 |
| 88 | 2.21 |
| 89 | 2.57 |
| 90 | 3.89 |
| 91 | 0.08 |
| 92 | 2.68 |
| 93 | 3.96 |
| 94 | 1.37 |
| 95 | 3.47 |
| 96 | 0.89 |
| 97 | 1.27 |
| 98 | 3.02 |
| 99 | 3.29 |
+----+------+

  1. 导师(stu_num为导师希望的招生数)
+----+---------+
| id | stu_num |
+----+---------+
|  1 |       8 |
|  2 |       2 |
|  3 |       7 |
|  4 |       7 |
|  5 |       3 |
|  6 |       7 |
|  7 |       6 |
|  8 |       8 |
|  9 |       5 |
| 10 |       6 |
| 11 |       6 |
| 12 |       2 |
| 13 |       3 |
| 14 |       8 |
| 15 |       3 |
| 16 |       2 |
| 17 |       6 |
| 18 |       2 |
| 19 |       2 |
| 20 |       2 |
| 21 |       4 |
| 22 |       7 |
| 23 |       8 |
| 24 |       3 |
| 25 |       1 |
| 26 |       1 |
| 27 |       5 |
| 28 |       1 |
| 29 |       6 |
| 30 |       1 |
+----+---------+

  1. 志愿及每个志愿的状态(0:已拒绝,1:已同意)
+----+----+----+----+----+----+----------+----------+----------+----------+----------+
| id | w1 | w2 | w3 | w4 | w5 | w1_statu | w2_statu | w3_statu | w4_statu | w5_statu |
+----+----+----+----+----+----+----------+----------+----------+----------+----------+
|  0 | 17 |  2 | 19 |  7 | 26 |        0 |        1 |        1 |        0 |        1 |
|  1 |  1 | 17 | 27 | 11 | 28 |        0 |        0 |        0 |        1 |        0 |
|  2 |  6 |  8 |  9 | 12 | 29 |        0 |        1 |        1 |        0 |        1 |
|  3 | 20 |  6 | 25 | 29 | 15 |        0 |        0 |        1 |        0 |        0 |
|  4 | 17 |  5 | 24 | 27 | 12 |        0 |        0 |        1 |        0 |        0 |
|  5 | 16 | 18 |  3 |  9 | 27 |        1 |        0 |        0 |        1 |        0 |
|  6 |  1 | 20 |  6 | 23 | 10 |        0 |        1 |        0 |        0 |        0 |
|  7 | 20 |  5 |  7 | 24 | 29 |        0 |        0 |        0 |        1 |        0 |
|  8 | 16 |  4 | 21 | 23 | 29 |        0 |        0 |        0 |        1 |        0 |
|  9 | 16 | 24 | 25 | 28 | 30 |        0 |        0 |        0 |        0 |        0 |
| 10 | 16 |  3 |  4 |  8 | 25 |        0 |        1 |        1 |        1 |        0 |
| 11 | 16 |  3 |  9 | 30 | 15 |        1 |        0 |        1 |        0 |        1 |
| 12 | 17 |  1 | 19 | 20 |  5 |        0 |        0 |        1 |        1 |        0 |
| 13 | 16 | 17 | 23 |  8 | 15 |        0 |        1 |        0 |        1 |        0 |
| 14 | 18 |  3 | 10 | 11 | 13 |        0 |        0 |        0 |        0 |        0 |
| 15 |  2 |  3 |  9 | 25 | 11 |        0 |        0 |        0 |        0 |        1 |
| 16 | 18 | 21 |  6 |  7 |  9 |        1 |        1 |        0 |        0 |        0 |
| 17 | 17 | 22 |  7 |  8 | 30 |        0 |        0 |        0 |        1 |        0 |
| 18 | 22 |  8 | 26 | 12 | 30 |        0 |        1 |        0 |        1 |        1 |
| 19 | 21 |  6 | 26 | 11 | 13 |        0 |        0 |        0 |        1 |        1 |
| 20 |  3 | 10 | 27 | 28 | 30 |        0 |        0 |        0 |        0 |        0 |
| 21 |  1 |  9 | 26 | 27 | 13 |        0 |        1 |        0 |        0 |        0 |
| 22 |  4 | 20 |  6 | 27 | 28 |        0 |        0 |        0 |        1 |        0 |
| 23 | 17 | 20 | 10 | 26 | 27 |        0 |        0 |        1 |        0 |        0 |
| 24 | 16 | 21 | 24 | 25 | 28 |        0 |        0 |        0 |        0 |        1 |
| 25 | 16 | 17 | 20 | 21 | 15 |        0 |        0 |        0 |        0 |        0 |
| 26 | 21 |  7 | 27 | 12 | 30 |        0 |        0 |        1 |        0 |        0 |
| 27 | 21 | 22 |  8 | 29 | 13 |        1 |        1 |        1 |        1 |        0 |
| 28 | 18 |  3 | 21 | 27 | 29 |        1 |        0 |        0 |        0 |        1 |
| 29 | 20 |  7 | 10 | 13 | 15 |        0 |        1 |        1 |        1 |        0 |
| 30 |  2 | 19 | 26 | 30 | 15 |        0 |        0 |        0 |        0 |        0 |
| 31 | 17 |  4 | 22 | 26 | 12 |        0 |        0 |        0 |        0 |        1 |
| 32 | 16 |  1 |  2 |  8 | 15 |        0 |        1 |        0 |        1 |        0 |
| 33 | 19 |  3 | 23 | 12 | 13 |        0 |        0 |        1 |        0 |        0 |
| 34 |  2 |  3 | 23 | 29 | 13 |        1 |        0 |        0 |        1 |        0 |
| 35 | 16 | 19 |  3 | 23 | 14 |        0 |        0 |        1 |        1 |        0 |
| 36 | 17 | 12 | 14 | 30 | 15 |        0 |        0 |        1 |        0 |        0 |
| 37 | 16 | 17 |  2 | 12 | 28 |        0 |        0 |        0 |        0 |        0 |
| 38 | 19 | 22 | 11 | 13 | 14 |        0 |        0 |        1 |        1 |        1 |
| 39 | 25 | 26 | 27 | 12 | 15 |        0 |        0 |        0 |        0 |        1 |
| 40 |  2 | 19 | 20 | 23 |  9 |        0 |        0 |        0 |        0 |        1 |
| 41 | 20 | 25 | 11 | 28 | 30 |        0 |        0 |        0 |        0 |        0 |
| 42 |  4 | 21 | 14 | 30 | 15 |        0 |        1 |        1 |        0 |        0 |
| 43 |  4 |  7 |  8 | 13 | 14 |        0 |        1 |        1 |        0 |        1 |
| 44 |  2 |  4 | 13 | 14 | 30 |        0 |        0 |        0 |        0 |        0 |
| 45 | 19 |  4 | 26 | 27 | 13 |        0 |        1 |        0 |        1 |        0 |
| 46 | 20 |  5 | 24 |  8 | 14 |        0 |        1 |        1 |        0 |        1 |
| 47 | 16 |  2 |  4 |  5 |  9 |        0 |        0 |        0 |        0 |        0 |
| 48 | 16 | 18 | 24 | 25 | 26 |        0 |        0 |        0 |        0 |        0 |
| 49 | 17 | 19 |  4 | 28 | 13 |        0 |        0 |        0 |        0 |        0 |
| 50 |  1 |  3 |  7 |  8 | 29 |        0 |        0 |        1 |        0 |        1 |
| 51 |  3 |  5 |  9 | 10 | 15 |        0 |        0 |        0 |        0 |        1 |
| 52 | 16 |  5 |  8 | 26 | 28 |        0 |        0 |        0 |        0 |        0 |
| 53 | 17 | 19 | 21 | 28 | 15 |        0 |        0 |        0 |        0 |        0 |
| 54 |  3 | 26 | 11 | 28 | 15 |        0 |        0 |        0 |        0 |        0 |
| 55 | 19 |  3 |  9 | 12 | 15 |        0 |        0 |        0 |        0 |        0 |
| 56 | 18 | 25 | 11 | 29 | 30 |        0 |        0 |        0 |        0 |        0 |
| 57 | 19 | 23 | 24 | 29 | 13 |        0 |        0 |        0 |        1 |        0 |
| 58 | 16 |  1 |  2 | 22 | 15 |        0 |        0 |        0 |        0 |        0 |
| 59 | 16 | 17 | 23 | 24 | 13 |        0 |        1 |        0 |        0 |        0 |
| 60 |  6 | 22 | 25 | 28 | 30 |        0 |        1 |        0 |        0 |        0 |
| 61 | 16 | 21 |  6 |  8 | 25 |        0 |        0 |        0 |        0 |        0 |
| 62 |  6 | 25 | 26 | 28 | 13 |        0 |        0 |        0 |        0 |        0 |
| 63 | 18 |  7 | 10 | 26 | 15 |        0 |        0 |        1 |        0 |        0 |
| 64 |  1 | 21 |  5 | 26 | 27 |        0 |        0 |        0 |        0 |        0 |
| 65 | 17 |  3 | 25 |  9 | 26 |        0 |        1 |        0 |        0 |        0 |
| 66 |  7 | 25 | 10 | 27 | 28 |        0 |        0 |        0 |        0 |        0 |
| 67 |  3 |  7 | 23 | 25 | 15 |        0 |        0 |        0 |        0 |        0 |
| 68 |  4 | 22 |  9 | 10 | 12 |        0 |        0 |        0 |        1 |        0 |
| 69 | 17 |  7 | 10 | 27 | 14 |        0 |        0 |        1 |        0 |        0 |
| 70 | 19 | 21 | 22 |  6 |  7 |        0 |        0 |        0 |        0 |        1 |
| 71 | 18 | 20 | 21 |  6 | 15 |        0 |        0 |        0 |        1 |        0 |
| 72 |  3 | 20 | 21 |  6 |  8 |        0 |        0 |        0 |        0 |        0 |
| 73 |  4 | 25 | 26 | 12 | 13 |        0 |        0 |        0 |        0 |        0 |
| 74 | 18 |  9 | 10 | 29 | 15 |        0 |        0 |        1 |        0 |        0 |
| 75 |  2 | 20 |  5 |  9 | 15 |        0 |        0 |        0 |        0 |        0 |
| 76 | 17 |  8 | 24 | 30 | 15 |        0 |        0 |        0 |        0 |        0 |
| 77 | 17 |  6 |  8 | 26 | 28 |        0 |        0 |        0 |        0 |        0 |
| 78 | 17 |  4 |  6 | 24 | 25 |        0 |        1 |        0 |        0 |        0 |
| 79 |  3 | 19 |  6 | 27 | 13 |        0 |        0 |        0 |        1 |        0 |
| 80 |  1 | 17 |  5 |  9 | 12 |        0 |        0 |        1 |        0 |        0 |
| 81 | 19 | 22 | 26 | 10 | 11 |        0 |        0 |        0 |        0 |        0 |
| 82 | 16 | 21 |  5 |  6 | 12 |        0 |        0 |        0 |        0 |        0 |
| 83 | 22 | 10 | 27 | 29 | 15 |        0 |        0 |        1 |        0 |        0 |
| 84 | 17 | 18 |  5 | 21 | 15 |        0 |        0 |        0 |        0 |        0 |
| 85 | 17 |  8 | 10 | 27 | 30 |        0 |        0 |        0 |        0 |        0 |
| 86 | 19 |  6 |  8 | 27 | 12 |        0 |        0 |        0 |        0 |        0 |
| 87 | 23 |  7 | 30 | 14 | 15 |        0 |        0 |        0 |        0 |        0 |
| 88 | 16 | 20 | 11 | 13 | 15 |        0 |        0 |        1 |        0 |        0 |
| 89 | 17 | 19 |  4 | 12 | 13 |        0 |        0 |        0 |        0 |        0 |
| 90 | 17 | 19 | 21 |  8 | 25 |        0 |        0 |        0 |        0 |        0 |
| 91 | 17 | 19 | 20 |  5 | 24 |        0 |        0 |        0 |        0 |        0 |
| 92 |  1 | 20 |  4 |  9 | 28 |        0 |        0 |        0 |        0 |        0 |
| 93 | 17 | 21 | 23 | 12 | 30 |        0 |        0 |        0 |        0 |        0 |
| 94 | 18 |  3 | 12 | 14 | 15 |        0 |        0 |        0 |        1 |        0 |
| 95 |  3 |  7 | 24 | 26 | 11 |        0 |        1 |        0 |        0 |        1 |
| 96 |  1 |  5 |  6 |  9 | 30 |        0 |        1 |        1 |        0 |        0 |
| 97 | 16 |  6 | 25 | 26 | 10 |        0 |        0 |        0 |        0 |        0 |
| 98 |  5 | 22 |  9 | 11 | 30 |        0 |        0 |        0 |        0 |        0 |
| 99 |  5 | 22 |  7 | 24 | 28 |        0 |        0 |        1 |        0 |        0 |
+----+----+----+----+----+----+----------+----------+----------+----------+----------+

输出数据

  1. 导师和学生间的匹配信息(id为导师的id)
+----+------+------+------+------+------+------+------+------+
| id | stu1 | stu2 | stu3 | stu4 | stu5 | stu6 | stu7 | stu8 |
+----+------+------+------+------+------+------+------+------+
|  1 |   32 |   58 |   64 |   92 | NULL | NULL | NULL | NULL |
|  2 |    0 |   34 | NULL | NULL | NULL | NULL | NULL | NULL |
|  3 |   10 |   14 |   15 |   35 |   54 |   65 |   67 | NULL |
|  4 |   31 |   44 |   45 |   47 |   73 |   78 |   89 | NULL |
|  5 |   46 |   80 |   96 | NULL | NULL | NULL | NULL | NULL |
|  6 |   62 |   71 |   72 |   82 |   86 |   97 | NULL | NULL |
|  7 |   29 |   43 |   50 |   66 |   95 |   99 | NULL | NULL |
|  8 |    2 |   17 |   18 |   52 |   76 |   85 | NULL | NULL |
|  9 |   21 |   51 |   55 | NULL | NULL | NULL | NULL | NULL |
| 10 |   20 |   23 |   63 |   68 |   69 |   74 | NULL | NULL |
| 11 |    1 |   19 |   38 |   41 |   56 |   88 | NULL | NULL |
| 12 |   37 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 13 |   48 |   91 | NULL | NULL | NULL | NULL | NULL | NULL |
| 14 |   36 |   94 | NULL | NULL | NULL | NULL | NULL | NULL |
| 15 |   84 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 16 |    5 |   11 | NULL | NULL | NULL | NULL | NULL | NULL |
| 17 |   13 |   49 |   59 |   77 |   90 |   93 | NULL | NULL |
| 18 |   16 |   28 | NULL | NULL | NULL | NULL | NULL | NULL |
| 19 |   12 |   81 | NULL | NULL | NULL | NULL | NULL | NULL |
| 20 |    6 |   75 | NULL | NULL | NULL | NULL | NULL | NULL |
| 21 |   25 |   27 |   42 |   61 | NULL | NULL | NULL | NULL |
| 22 |   60 |   70 |   98 | NULL | NULL | NULL | NULL | NULL |
| 23 |    8 |   33 |   40 |   87 | NULL | NULL | NULL | NULL |
| 24 |    4 |    7 |   24 | NULL | NULL | NULL | NULL | NULL |
| 25 |    3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 26 |   30 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 27 |   22 |   26 |   39 |   79 |   83 | NULL | NULL | NULL |
| 28 |   53 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 29 |   57 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
| 30 |    9 | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+----+------+------+------+------+------+------+------+------+

  1. 未被分配到学生的导师

所有导师均分配到学生

  1. 未分配到导师的学生

所有学生均分配到导师

感想及建议

以前的算法知识忘得差不多了,这次的编程也没用什么很好的算法,在结对编程过程中,队友发现我的代码不写注释,排版也有些混乱,帮我改了一下,我也觉得好多了,确实应该养成良好的代码习惯。在整个过程中,涉及到github,eclipse,mysql等软件的使用,多亏了队友的帮助,才能我的任务继续下去,队友真的帮了我很多,我要好好学习,争取下次做得更好。

代码

生成数据的程序

导师分配程序

Copyright © 2024 yzlsj
Powered by .NET 9.0 on Kubernetes