1、完整word版学生考勤管理系统doc一、设计内容与设计要求1设计内容: 学生考勤管理系统1、问题描述学生信息包括:学号、姓名、性别、年龄、班级等信息。考勤信息包括:缺课日期、第几节课、课程名称、学生姓名、缺课类型(迟到、早退、请假和旷课)。2、功能要求(1)添加功能: 程序能够添加学生的记录和缺课记录, 提供选择界面供用户选择所要添加的类别。添加学生记录时, 要求学号要唯一, 如果添加了重复学号的记录时, 则提示数据添加重复并取消添加。(2)查询功能:可根据学号、姓名等信息对已添加的学生记录进行查询,如果未找到,给出相应的提示信息,如果找到,则显示相应的记录信息。还可以按课程名、学生姓名对缺课
2、记录进行查询。(3)显示功能:可显示当前系统中所有学生的记录和缺课记录,每条记录占据一行。(4)编辑功能:可根据查询结果对相应的记录进行修改,修改时注意学号的唯一性。(5)删除功能: 主要实现对已添加的学生记录进行删除。 如果当前系统中没有相应的记录, 则提示“记录为空! ”并返回操作。(6)统计功能: 能根据多种参数进行统计。 能按课程名统计出学生旷课的信息、 还可以按姓名统计出任一学生的旷课情况。需要排序。(7)保存功能:可将当前系统中各类记录存入文件中,存入方式任意。(8)读取功能:可将保存在文件中的信息读入到当前系统中,供用户进行使用。一、需求分析 61. 系统设计目的与意义 62.
3、系统功能需求(系统流程图) 63. 系统功能流程图 74. 输入输出的要求 7二、总体分析 71. 系统功能分析 82. 系统功能结构图 8三、详细设计 91. 类设计: 111四、界面设计与各功能模块的实现 121. 界面设计 12五、系统调试 141. 首页进入学籍管理系统主菜单 142 录入学生信息缺课界面: 153. 显示学生信息缺课界面 164. 查找学生信息界面 175. 删除学生信息界面 186. 修改学生信息 187. 统计学生信息: 19六、 使用说明及心得体会 20七、附件 20一、需求分析1.系统功能流程图2主程序初 菜始 单化 程程 序序录 显 查 删 修 统 保入 示
4、 找 除 改 计 存退出3.输入输出的要求1.输入的要求:通过主函数体调用其他函数应用系统主控界面包括学生信息录入, 查找等功能模块。 学生信息录入功能完成学生信息和缺课信息的输入。 记录查询功能可以对数据各分类的记录进行查询。2.输出的要求:1)能够按编号、姓名对学生的信息进行检索并将检索结果显示在屏幕上。2)可以统计全部学生缺课类型,及其缺课次数。3)如果检索不到相应的信息应提示用户。二、总体分析系统功能分析能够从屏幕上读取一个学生的信息和缺课信息并将信息存入到数据文件中。能够将指定的信息从文件中删除。 能够按编号、姓名对学生的信息进行检索并将检索结果显示在屏幕上。可以统计全部学生缺课次数
5、, 及其缺课类型。 要求有错误提示功能。如果检索不到相应的信息应提示用户。3三、详细设计1.类设计:类: Person数据成员学号,姓名,性别,年龄,班级缺课类型,缺课次数,指针域double num; / 学号char Name20; / 姓名char sex;/ 性别double old;/ 年龄long double G;/ 班级int Duty; / 缺课类型 (1- 迟到 ,2- 早退 ,3- 请假 ,4- 旷课 )double Salary; / 缺课次数Person *next; / 指针域 、成员函数Person() / 基类构造next=0; / 指针域设置为空virtual
6、 Person() / 基类虚析构virtual void Input()=0; / 从键盘输入数据virtual void Input(ifstream& ifs)=0; / 从文件输入数据virtual void Output()=0; / 向屏幕输出数据virtual void Output(ofstream& ofs)=0; / 向文件输出数据virtual double Incoming()=0; / 计算次数friend class College;类: Teacher (公共继承与 Person 类)数据成员:4protected:int Hours; / 第几节课char B;
7、/ 迟到日期char Z;/ 课程名称 class school成员函数: Tercher ()void Input()void Input(ifstream& ifs)void Output(ofstream& ofs)double Incoming()迟到类:class Assistant:virtual public Person数据成员:protected:int Allowance;int Hours; / 第几节课char B;/ 早退日期char Z;/ 课程名称成员函数:Assistant ()void Input()void Input(ifstream& ifs)void
8、Output()void Output(ofstream& ofs)double Incoming()请假类:class Manager:virtual public Person数据成员:protected:int Allowance;int Hours; / 第几节课char B;/ 请假日期char Z;/ 课程名称5成员函数:Manager()void Input()void Input(ifstream& ifs)void Output()void Output(ofstream& ofs)double Incoming()旷课类:class Teacher_Assistant:pu
9、blic Teacher,public Assistant成员函数:Teacher_Assistant()void Input()void Input(ifstream& ifs)void Output()void Output(ofstream& ofs)double Incoming()学生类:class College数据成员private:Person *PL;void Clear();int College:Cfind(int ID,Person *p1,Person *p2)成员函数:public:College(); /构造College(); /析构void Add(); /退
10、出void Delete(); /删除void Modify(); /修改void Print(); /输出void Save(); /信息存盘6void Load(); / 信息装入void Find(); / 查找void Build(); / 导引void Stat(); / 统计四、 界面设计与各功能模块的实现1.界面设计1.界面设计程序运行后会出现一个简捷的窗口,便于用户查询数据。2.功能模块实现设计通过主窗体调用其他窗体。 应用系统主控界面包括学生信息录入, 查找等功能模块。 学生信息录入功能完成学生信息和成绩的输入。 记录查询功能可以对数据各分类的记录进行查询。具体举例如下:1)
11、输入函数:void Input()coutnum;coutName;coutsex;coutold;coutG;coutHours;Salary=Incoming(); 2 )删除函数void school:del()student *p,*p2;int num;coutnum;if( !find(&p,num,) )coutSORRY!找不到你要删除的内容 !next)-output();p2=p-next;p-next=p2-next;delete p2;school:setkey(1);2.类的派生之间的示意图PersonTercher Assitant MannagerTercher_
12、Assitant五、 系统调试1. 首页进入学生考勤管理系统主菜单2录入学生信息界面:83.显示学生信息界面 :4.修改学生信息六、 使用说明及心得体会此次 c+课程设计,在指导教师的精心教导下,我学会了如何用 C+编写一个简单的应用程序。首先要对程序的设计要求有一个比较明确的认识,然后系统分析与系统设计,最后是代码设计与调试。 程序实现上,设计了简单的查询界面, 将各个功能集中出来按照程序编写原则,便于查询。七、附件源文件代码:#include 文件操作头文件#include 字符串流class Person /人员类 (抽象类 ) protected:double num; / 学号cha
13、r Name20; / 姓名char sex;/性别double old;/ 年龄9long double G;/ 班级int Duty; / 缺课类型 (1-迟到 ,2-早退 ,3-请假 ,4- 旷课 )double Salary; /缺课次数Person *next; /指针域public:Person() /基类构造 next=0; / 指针域设置为空 virtual Person() / 基类虚析构 virtual void Input()=0; / 从键盘输入数据virtual void Input(ifstream& ifs)=0; / 从文件输入数据virtual void Ou
14、tput()=0; / 向屏幕输出数据virtual void Output(ofstream& ofs)=0; / 向文件输出数据virtual double Incoming()=0; / 计算次数friend class College; ;class Teacher:virtual public Person /迟到类 protected:int Hours; / 第几节课 char B;/ 迟到日期 char Z;/ 课程名称public: Duty=1; Salary=800; void Input() / 键盘补充输入其它数据 coutnum; coutName; coutsex
15、; coutold; coutG; coutHours; Salary=Incoming(); void Input(ifstream& ifs) ifsnumNamesexoldGDutyHoursSalary; void Output() coutnumtNametsextoldtGtDutytHourstSalarytendl; void Output(ofstream& ofs) ofsnumtNametsextoldtGtDutytHourstSalaryt120)return Salary+(Hours-120)*20;elsereturn Salary; ;class Assis
16、tant:virtual public Person / 早退 protected: int Allowance;10int Hours; / 第几节课char B;/ 早退日期char Z;/ 课程名称public:Assistant() Duty=2;Salary=650;Allowance=150; void Input() coutnum; coutName; coutsex; coutold; coutG; coutHours; Salary=Incoming(); void Input(ifstream& ifs) ifsnumNamesexoldGDutyHoursSalary;
17、 void Output() coutnumtNametsextoldtGtDutytHourstSalarytendl; void Output(ofstream& ofs) ofsnumtNametsextoldtGtDutytHourstSalaryt70)return Salary+Allowance+(Hours-70)*20; elsereturn Salary+Allowance; ;class Manager:virtual public Person / 请假 protected: int Allowance;int Hours; / 第几节课char B;/ 请假日期cha
18、r Z;/ 课程名称public:Manager() Duty=3;Salary=750;Allowance=250; void Input() coutnum; coutName;coutsex;coutold;coutG;coutHours;11Salary=Incoming(); void Input(ifstream& ifs) ifsnumNamesexoldGDutyHoursSalary; void Output() coutnumtNametsextoldtGtDutytHourstSalarytendl; class Collegeprivate: Person *PL; v
19、oid Clear();int College:Cfind(int ID,Person *p1,Person *p2); public:College(); / 构造College(); / 析构void Add(); / 退出void Delete(); / 删除void Modify(); / 修改void Print(); / 输出void Save(); / 信息存盘void Load(); / 信息装入void Find(); / 查找void Build(); / 导引void Stat(); / 统计;College:College() / 构造函数 (创建 1 个头结点的链表
20、)Person *p=new Teacher;PL=p; coutnext;delete p;p=PL;PL=0;void College:Add() / 增加char c; do coutInput();p-next=pt;break;case 2: pa=new Assistant; pa-Input();p-next=pa;break;case 3: pm=new Manager; pm-Input();p-next=pm;break;case 4: pta=new Teacher_Assistant; pta-Input();p-next=pta;break;default: retu
21、rn;coutc;while(c=y|c=Y);Save();/ 查找void College:Find()double ID;Person *p1;Person *p2;coutID;p1=PL-next;p2=PL;while(p1)if(p1-num=ID)break; /找到elsep2=p1; / 继续查找p1=p1-next;if(!p1) cout 找不到你所查询的人 !n 请确认你所查询的编号是否出错 !n;return;else coutn* 出勤信息表 *n;coutOutput();/查找缺课结点 (返回 1-找到, 0-未找到 .结点指针由 p1 返回 ,p2 为前看指
22、针 )int College:Cfind(int ID,Person *p1,Person *p2)*p1=PL-next;*p2=PL;while(*p1)if(*p1)-num=ID)break; /找到else*p2=*p1; / 继续查找*p1=(*p1)-next;return *p1?1:0;void College:Delete() / 删除coutn* 删除 *n;int num; Person *p1,*p2;coutnum;if(!Cfind(num,&p1,&p2)coutnext=p1-next; / 连接delete p1;cout 正确删除 !n;Save();vo
23、id College:Modify() / 修改coutn* 修改 *n;int num;Person *p1,*p2;coutnum;if(!Cfind(num,&p1,&p2)coutOutput(); / 输出原来的出勤信息 ( 做提示 )p1-Input(); / 输入新的出勤信息 (更新 )cout 修改完成 !n;Save(); void College:Print() / 输出出勤信息coutn* 出勤信息表 *n;coutnext;if(!p)coutOutput();p=p-next;void College:Save() / 出勤信息存盘 ?ofstream f(Person.dat,ios:out); / 打开文件Person *p=PL-next;while(p)p-Output(f);p=p-next;f.close(); / 关闭文件cout 职工信息已经保存在 Person.dat.n;void College:Build() / 出勤信息char buf81; / 临时空间int Duty; / 人员类型Person *p2; /新建结点的指针long t; / 读写位置Clear();
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2