1. Practice content
Student Records Management System
(1) Practical tasks
- Entry of student information, including student ID, name, major, grades of four courses, total score, and ranking;
- The system can browse, add, delete and modify student information;
- The ranking and information output are determined according to the students' scores, with bidirectional bubble sorting, hill sorting, quick sorting, and heap sorting.
- The student information can be inquired upon request, according to the student number or name;
- Information modification can only modify the scores of four courses;
- File access student information.
(2) Project requirements
- Add student information (including student ID, name, major, 4 course results...)
- Browse student information (browse the information after sorting the students)
- Delete student information (delete the information of the specified student, and the user can choose to retrieve the specified item)
- Find student information (find a record that meets the conditions)
- Save student information (save student score file information to a text file)
- Load student information (after logging in to the system, read the student score information saved in the disk file into the memory)
2. Development environment
Implementation language: Java
development platform: IntelliJ IDEA
3. Project design
(1) Class definition
- Student Information
stuNum //学号
stuName //姓名
stuMajor //专业
stuScore1 //课程1成绩
stuScore2 //课程2成绩
stuScore3 //课程3成绩
stuScore4 //课程4成绩
stuTotalScore //总成绩
stuRank //排名
- System user class
accountNum //用户账号
accountPassword //账户密码
- Database class
accountList //用户列表
stuList //学生列表
- Text interaction
学生信息写入导出
- System user method class
系统用户信息增删改查
- Student Information Method
学生信息增删改查
- Account login system class
系统登录界面及具体方法
- Student Information Management
学生信息管理界面及具体方法
- Main system class
系统入口界面及具体方法
(2) Sorting algorithm
- Two-way bubble sort
比较相邻两个元素的大小。如果前一个元素比后一个元素大,则两元素位置交换;
对数组中所有元素的组合进行第1步的比较;
奇数趟时从左向右进行比较和交换;
偶数趟时从右向左进行比较和交换;
当从左端开始遍历的指针与从右端开始遍历的指针相遇时,排序结束。
- Hill sort
先取一个小于n的步长d1,把表中全部元素怒分成d1个组,所有距离为d1的倍数的记录放在同一个组中,在各组中进行直接插入排序;
取第二个步长d2<d1,重复上述过程,直到所取到的d=1,即所有元素已放在同一组中,再进行直接插入排序。
- Quick sort
先从数列中取出一个数作为基准数;
将比这个数大的数全放到它的右边,小于或等于它的数全放到它的左边;
再对左右区间重复上述二步,直到各区间只有一个数。
- Heap sort
首先将待排序的数组构造成一个大根堆,此时,整个数组的最大值就是堆结构的顶端;
将顶端的数与末尾的数交换,此时,末尾的数为最大值,剩余待排序数组个数为n-1;
将剩余的n-1个数再构造成大根堆,再将顶端数与n-1位置的数交换,如此反复执行,便能得到有序数组。