水电煤气管理系统

上传人:风*** 文档编号:60304534 上传时间:2022-03-07 格式:DOC 页数:51 大小:341.50KB
收藏 版权申诉 举报 下载
水电煤气管理系统_第1页
第1页 / 共51页
水电煤气管理系统_第2页
第2页 / 共51页
水电煤气管理系统_第3页
第3页 / 共51页
资源描述:

《水电煤气管理系统》由会员分享,可在线阅读,更多相关《水电煤气管理系统(51页珍藏版)》请在装配图网上搜索。

1、精选优质文档-倾情为你奉上 面向对象程序设计课外实践报告项 目 名 称: 水电气管理系统 所 在 班 级: 计算机科技与技术 小 组 成 员: 王耀权、董金明 指 导 教 师: 葛文英 起 止 时 间: 2014.11.252015.12.20 项目基本信息项目名称设计一个水电气管理系统项目简介1问题描述设计一个水电管理信息系统,能够对高校的水电费用进行管理,包括登记费用、查询费用和住户信息管理等。在设计时要考虑到学生和教工在用水电时的不同,学生可以免费使用一定额度的水电,超过这个额度的水电以后必须自费使用,且自费部分水电费的价格标准要高于教工的收费标准(主要是节约资源)。2基本要求实现对用户

2、信息的录入。实现水电煤气数据的录入。计算并查询用户应缴费用。查询未缴纳费用的名单。3测试数据可选用小区物业管理部门的数据,也可采用手工输入不少于10个用户信息的数据。小组成员 王耀权、董金明任务分工这个程序是一起做的,王耀权主要做的是学生水电气管理系统,董金明做的是老师水电气管理系统,然后再会合改错误,最后一起把这个是实验报告完成。一、问题描述及分析:设计一个水电管理信息系统,能够对高校的水电费用进行管理,包括登记费用、查询费用和住户信息管理等。在设计时要考虑到学生和教工在用水电时的不同,学生可以免费使用一定额度的水电,超过这个额度的水电以后必须自费使用,且自费部分水电费的价格标准要高于教工的

3、收费标准(主要是节约资源)。二、功能模块及结构描述:功能模块: 1.在主函数中通过分支选择可以跳转不同的功能选项进而实现2.在显示主菜单函数中,我们通过设计友好界面来与用户进行交互。在“请选择相应功能(1-3):”中使用者输入非1-3数字或其他字符时,系统提示结束然后从新开始。3.进入学生管理系统菜单或者老师管理系统菜单会出现相应功能(1-6):分别对应的有交费功能、查询一个功能、查询全部功能、增加功能、删除功能。学生的查询功能分别为学号和姓名,老师的查询功能为编号和姓名,也可以查询到是否缴费,如未交费就会分别显示水费、电费、煤气费、费用并显示总费用。4.交费时它会显示费用多少,实际交了多少钱

4、,如果钱交多了显示应找零多少。结构描述: 1.首先建立了Feebz类,用于初始化身份证号码、姓名、用水电、煤气量,又定义了缴费函数Get(),用在有人缴费的函数体中,从键盘输入缴的费用,一开始我们在Get(),中没有对缴的费用进行累加,在查询信息时现实的应缴费用不正确,经过我们的努力,检查出错误并加以改正,让程序更加完善。2.用Feebz类派生出StuMan和|TeaMan类,其中有计算应该缴的费用,StuMan类比TeaMan类多了免费。3.在保存文件的处理中,需考虑到“查询失败”和“重新输入”等诸多内容三、主要流程描述:水 电 气 管 理 系 统选操作对象退 出 系 统教 师学 生选择操作

5、对象缴 纳 水 电 气 费查询一个学生水电气用量查询所有学生交费情况增 加 学 生 信 息删 除 学 生 信 息退出 系 统缴纳水电气费查询一个教师的水电用量查询所有教师缴费情况增加教师信息删除教师信息退出系统退 出退 出 系 统流程图:选择操作对象 四、使用说明:程序运行后,进入界面:在如上所示的界面下,根据提示进行基本的操作。五、 问题及解决方法问题1. 觉得该系统的不足就是不能够实现查看某个人的用水量、用电量或者用气量中的一种和应该支付的钱。问题2还有一个不足就是程序感觉不够简练,有点罗嗦。解决方法:对于解决这些问题,觉得应该定义子函数来提取每个人的信息这样就可以实现查看某人的用水量、用

6、电量、或者用气量的一种和应该支付的钱。对于问题2这需要有扎实的基本功,能都用最简短的源程序代码去解决一个相同的问题。六、 实践总结:课程设汁的过程中遇到了很多麻烦,虽然我早有心理准备,但还是令我伤透了脑筋,只怪自己平时看书太少,其实有很多东匹在书上都可以找到答案的,可是还是有一些问題我实在没有办法解决,最终通过老师和同学们的努力解决了一个又一个的问题。通过这次课程设计,我学习到了很多知识,并且给了我一个星月的时间去重新认真的有目的性的C+语言进行复习,查找补漏,为后续课程做充足的准备。设计的过程是困难的,因为以前没有类似的经验刚开始的几天没有太多进展,不过我们没有灰心,经过认真思考以及老师帮助

7、,最我们有了很好的设设计方法。程序的完成使我们很高兴,所有的疲惫己经不算什么了,现在觉得要想编写一个好的程序真的很累,它需要牢固的基础知识作为 铺垫,所有源代码的编写输入以及每一步的调试都容不得一点马虎,整个牢固的基础是编程的最基本需要,要想好每一步的算法,要想到每一个相应的函数。我觉得一月的课程设计远远比我自己看一学期书的 收获多,实践是检验知识的最隹手段。七、 源代码:#include #include #include #include #include using namespace std; int ns,nt; class Feebz / 学生的信息类 public: Feebz(

8、string Num=,string Name=董金明, double water=1,double power=0,double gas=10); / 构造函数 friend ostream &operator (ostream &out,Feebz &r) /运算符重载 outsetw(12)leftr.number; outsetw(8)leftr.name; outsetw(8)leftr.water; outsetw(8)leftr.power; outsetw(8)leftr.gas; outsetw(8)leftr.GetW(); outsetw(8)leftr.GetP();

9、outsetw(8)leftr.GetG(); outsetw(8)leftr.GetTotal(); if(r.flag) out已交; else out未交; return out; void operator =(Feebz r); / 运算符重载 double GetW(); / 计算学生水费 double GetP(); / 计算学生电费 double GetG(); / 计算学生气费 double GetTotal() return GetW()+GetP()+GetG(); / 计算学生总费用 string number,name; int flag; double water,

10、power,gas,Waterprice,Powerprice,Gasprice; ; Feebz:Feebz(string Num,string Name, double Water, double Power, double Gas) / 构造函数 number=Num; name=Name; water=Water; power=Power; gas=Gas; flag=0; void Feebz:operator =(Feebz r) / 赋值运算符重载 name=r.name; number=r.number; water=r.water; power=r.power; gas=r.

11、gas; double Feebz:GetW() / 计算学生水费 if(water=6) Waterprice=0; else Waterprice=0.6*(water-6); return Waterprice; double Feebz:GetP() / 计算学生电费 if(power=6) Powerprice=0; else Powerprice=0.6*(power-6); return Powerprice; double Feebz:GetG() / 计算学生气费 if(gas=6) Powerprice=0; else Powerprice=0.6*(gas-6); ret

12、urn Powerprice; class StuMan / 学生管理类 public: StuMan(int sz=50) size=sz; St=new Feebzsize; /构造函数 StuMan() delete St; / 析构函数 void MainMenu(); / 主菜单 void FeeMenu(); / 学生交费菜单 void NumFee(); / 输入学号交费void NameFee(); / 输入姓名交费 void CheckMenu(); / 学生查询菜单 void NumCheck(); / 输入学号查询 void NameCheck(); / 输入姓名查询 v

13、oid Add(); / 增加学生功能 void DeleteMenu(); / 学生删除菜单 void NumDelete(); / 输入学号删除 void NameDelete(); / 输入姓名删除void Regist(); void Chakan(); / 学生查看作用private: int size; Feebz *St; ; void StuMan:MainMenu() / 主菜单 system(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 欢 迎 使

14、 用 教 师 水 电 气 费 管 理 系 统endl; cout 1.缴纳水电气费endl; cout 2.查询一个同学水电气费用量endl; cout 3.查看所有同学的缴费情况endl; cout 4.增加学生信息endl; cout 5.删除学生信息endl; cout 6.退出系统endl; while(1) coutchoice; switch(choice) case 1:FeeMenu(); break; case 2:CheckMenu(); break; case 3:Chakan(); break; case 4:Add(); break; case 5:DeleteMen

15、u(); break; default: break; if(choice=6) break; void StuMan:Regist() int i=0; ifstream tfile(student.txt); while(tfile.good() tfileSti.number; tfileSti.name; tfileSti.water; tfileSti.power; tfileSti.gas; i+; tfile.close(); ns=i; void StuMan:FeeMenu() /学生交费菜单 system(cls); int choice; cout endl; cout

16、endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 学 生 交 费 菜 单endl; cout 1.按照学号交费endl; cout 2.按照姓名交费endl; cout 3.返回主菜单endl; cout 4.退出系统endl; while(1) coutchoice; switch(choice) case 1:NumFee(); break; case 2:NameFee(); break; case 3:system(cls); MainMenu(); break; default:exit(1); if(choice=3) bre

17、ak; void StuMan:NumFee() / 输入学号交费 string number; float money; int flag=0,flag1=0; cout欢迎使用交费功能endl; coutnumber; for(int i=0;ins;i+) if(number=Sti.number) flag1=1; cout该同学应该交费共Sti.GetTotal()元endl; coutmoney; if(moneySti.GetTotal() cout该同学需再补交Sti.GetTotal()-money元endl; Sti.flag=0; MainMenu(); else cou

18、t该同学交费成功,且找零钱为money-Sti.GetTotal()元endl; Sti.flag=1; MainMenu(); break; if(!flag1) system(cls); cout该学生的学号输入错误,请重新使用该功能!endl; NumFee(); void StuMan:NameFee() / 输入姓名交费 string name; float money; int flag=0,flag1=0; cout 欢迎使用交费功能endl; coutname; for(int i=0;ins;i+) if(name=Sti.name) flag1=1; cout该同学应该交费

19、共Sti.GetTotal()元endl; coutmoney; if(moneySti.GetTotal() cout该同学需再补交Sti.GetTotal()-money元endl; Sti.flag=0; MainMenu(); else cout该同学交费成功,且找零钱为money-Sti.GetTotal()元endl; Sti.flag=1; MainMenu(); break; if(!flag1) system(cls); cout该学生的姓名输入错误,请重新使用该功能!endl; NameFee(); void StuMan:CheckMenu() / 学生查询菜单 syst

20、em(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 学 生 查 询 菜 单endl; cout 1.按照学号查询endl; cout 2.按照姓名查询endl; cout 3.返回主菜单endl; cout 4.退出系统endl; while(1) cout请选择:choice; switch(choice) case 1:NumCheck(); break; case 2:NameCheck(); break; case 3:system(cls); MainMen

21、u(); break; default:exit(1); if(choice=3) break; void StuMan:NumCheck() / 输入学号查询 string number; int flag1=0,i,item; cout欢迎使用查询功能endl; coutnumber; for(i=0;ins;i+) if(number=Sti.number) flag1=1; item=i; break; if(flag1) cout学号 姓名用水量 用电量 用煤气量 水费 电费 煤气费 总额 交费否endl; coutStitemendl; else system(cls); cout

22、该学生的学号输入错误,请重新使用该功能!endl; NumCheck(); void StuMan:NameCheck() / 输入姓名查询 string name; int flag1=0,i,item; cout欢迎使用查询功能endl; coutname; for(i=0;ins;i+) if(name=Sti.name) flag1=1; item=i; break; if(flag1) cout学号姓名 用水量用电量 用煤气量 水费电费 煤气费 总额 交费否endl; coutStitemendl; else system(cls); cout该学生的学号输入错误,请重新使用该功能!

23、endl; NameCheck(); void StuMan:DeleteMenu() / 学生删除菜单 system(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 学 生 删 除 菜 单endl; cout 1.按照学号删除endl; cout 2.按照姓名删除endl; cout 3.返回主菜单endl; cout 4.退出系统endl; while(1) coutchoice; switch(choice) case 1:NumDelete(); break;

24、case 2:NameDelete(); break; case 3:system(cls); MainMenu(); break; default:exit(1); if(choice=3) break; void StuMan:NumDelete() / 输入学号删除 string number; int item=1,i,j; cout欢迎使用删除功能endl; coutnumber; for(i=0;ins;i+) if(number=Sti.number) item=0; j=i; break; if(!item) for(j=i;jns-1;j+) Stj=Stj+1; cout该

25、学生的信息已被删除!endl; if(item) system(cls); cout该学生的学号输入错误,请重新使用该功能!endl; NumDelete(); void StuMan:NameDelete() / 输入姓名删除 string name; int item=1,i,j; cout欢迎使用删除功能endl; coutname; for(i=0;ins;i+) if(name=Sti.name) item=0; j=i; break; if(!item) for(j=i;jns-1;j+) Stj=Stj+1; cout该学生的信息已被删除!endl; if(item) syste

26、m(cls); cout该学生的姓名输入错误,请重新使用该功能!endl; NameDelete(); void StuMan:Add() / 增加学生功能 int n,i,j=1; coutn; i=ns; for(;nsi+n;ns+) cout请输入第j个学生的学号、姓名、水用量、电用量、用气量:Stns.number; cinStns.name; cinStns.water; cinStns.power; cinStns.gas; j+; void StuMan:Chakan() / 学生查看功能 int i; cout已交费学生信息endl; cout学号 姓名 用水量用电量用煤气量

27、 水费 电费煤气费 总额 交费否endl; for( i=0;ins;i+) if(Sti.flag) coutSti; coutendl; coutendl; coutendl; cout未交费学生信息endl; cout学号姓名 用水量用电量 用煤气量水费 电费 煤气费 总额 交费否endl; for(i=0;ins;i+) if(!Sti.flag) coutSti; class TFeebz / 教师的信息类 public: TFeebz(string Num=01,string Name=王耀权,double water=1,double power=0,double gas=10)

28、 ; friend ostream &operator (ostream &out,TFeebz &r) / 运算符重载 outsetw(12)leftr.number; outsetw(8)leftr.name; outsetw(8)leftr.water; outsetw(8)leftr.power; outsetw(8)leftr.gas; outsetw(8)leftr.GetW(); outsetw(8)leftr.GetP(); outsetw(8)leftr.GetG(); outsetw(8)leftr.GetTotal(); if(r.flag) out已交; else ou

29、t未交; return out; void operator =(TFeebz r); / 运算符重载 double GetW(); / 计算教师水费 double GetP(); / 计算教师电费 double GetG(); / 计算教师气费 double GetTotal() return GetW()+GetP()+GetG(); / 计算教师总费用 string number,name; int flag; double water,power,gas,Waterprice,Powerprice,Gasprice; ; TFeebz:TFeebz(string Num,string

30、Name,double Water,double Power,double Gas) / 构造函数 number=Num; name=Name; water=Water; power=Power; gas=Gas; flag=0; void TFeebz:operator =(TFeebz r) / 运算符重载 name=r.name; number=r.number; water=r.water; power=r.power; gas=r.gas; double TFeebz:GetW() / 计算教师水费 Waterprice=0.5*(water-6); return Waterpric

31、e; double TFeebz:GetP() / 计算教师电费 Powerprice=0.5*(power-6); return Powerprice; double TFeebz:GetG() / 计算教师气费 Powerprice=0.5*(gas-6); return Powerprice; class TeaMan / 教师管理类public: TeaMan(int sz=50) size=sz; Te=new TFeebzsize; / 构造函数 TeaMan() delete Te; / 析构函数 void MainMenu(); / 主菜单 void FeeMenu(); /

32、教师交费菜单 void NumFee(); / 输入编号交费 void NameFee(); / 输入姓名交费 void CheckMenu(); / 教师查询菜单 void NumCheck(); / 输入编号查询 void NameCheck(); / 输入姓名查询 void Add(); / 增加教师功能 void DeleteMenu(); / 教师删除菜单 void NumDelete(); / 输入编号删除 void NameDelete(); / 输入姓名删除 void Regist(); void Chakan(); / 教师查看菜单 private: int size; TF

33、eebz *Te; ; void TeaMan:MainMenu() / 主菜单 system(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 欢 迎 使 用 教 师 水 电 气 费 管 理 系 统endl; cout 1.缴纳水电气费endl; cout 2.查询一个教师水电气费用量endl; cout 3.查看所有教师的缴费情况endl; cout 4.增加教师信息endl; cout 5.删除教师信息endl; cout 6.退出系统endl; while(1)

34、coutchoice; switch(choice) case 1:FeeMenu(); break; case 2:CheckMenu(); break; case 3:Chakan(); break; case 4:Add(); break; case 5:DeleteMenu(); break; default: break; if(choice=6) break; void TeaMan:Regist() int i=0; ifstream tfile(teacher.txt); while(tfile.good() tfileTei.number; tfileTei.name; tf

35、ileTei.water; tfileTei.power; tfileTei.gas; i+; tfile.close(); nt=i; void TeaMan:FeeMenu() /教师交费菜单 system(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 教 师 交 费 菜 单 endl; cout 1.按照编号号交费endl; cout 2.按照姓名交费endl; cout 3.返回主菜单endl; cout 4.退出系统endl; while(1) coutchoice; switch(choice)

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!