收藏 分销(赏)

水电煤气综合管理系统.doc

上传人:精**** 文档编号:3032423 上传时间:2024-06-13 格式:DOC 页数:61 大小:341.04KB
下载 相关 举报
水电煤气综合管理系统.doc_第1页
第1页 / 共61页
水电煤气综合管理系统.doc_第2页
第2页 / 共61页
水电煤气综合管理系统.doc_第3页
第3页 / 共61页
水电煤气综合管理系统.doc_第4页
第4页 / 共61页
水电煤气综合管理系统.doc_第5页
第5页 / 共61页
点击查看更多>>
资源描述

1、 面向对象程序设计课外实践汇报项 目 名 称: 水电气管理系统 所 在 班 级: 计算机科技和技术 小 组 成 员: 王耀权、董金明 指 导 教 师: 葛文英 起 止 时 间: .11.25.12.20 项目基础信息项目名称设计一个水电气管理系统项目介绍1问题描述设计一个水电管理信息系统,能够对高校水电费用进行管理,包含登记费用、查询费用和住户信息管理等。在设计时要考虑到学生和教工在用水电时不一样,学生能够无偿使用一定额度水电,超出这个额度水电以后必需自费使用,且自费部分水电费价格标准要高于教工收费标准(关键是节省资源)。2基础要求实现对用户信息录入。实现水电煤气数据录入。计算并查询用户应缴费

2、用。查询未缴纳费用名单。3测试数据可选择小区物业管理部门数据,也可采取手工输入不少于10个用户信息数据。小组组员 王耀权、董金明任务分工这个程序是一起做,王耀权关键做是学生水电气管理系统,董金明做是老师水电气管理系统,然后再见合改错误,最终一起把这个是试验汇报完成。一、问题描述及分析:设计一个水电管理信息系统,能够对高校水电费用进行管理,包含登记费用、查询费用和住户信息管理等。在设计时要考虑到学生和教工在用水电时不一样,学生能够无偿使用一定额度水电,超出这个额度水电以后必需自费使用,且自费部分水电费价格标准要高于教工收费标准(关键是节省资源)。二、功效模块及结构描述:功效模块: 1.在主函数中

3、经过分支选择能够跳转不一样功效选项进而实现2.在显示主菜单函数中,我们经过设计友好界面来和用户进行交互。在“请选择对应功效(1-3):”中使用者输入非1-3数字或其它字符时,系统提醒结束然后从新开始。3.进入学生管理系统菜单或老师管理系统菜单会出现对应功效(1-6):分别对应有交费功效、查询一个功效、查询全部功效、增加功效、删除功效。学生查询功效分别为学号和姓名,老师查询功效为编号和姓名,也能够查询到是否缴费,如未交费就会分别显示水费、电费、煤气费、费用并显示总费用。4.交费时它会显示费用多少,实际交了多少钱,假如钱交多了显示应找零多少。结构描述: 1.首先建立了Feebz类,用于初始化身份证

4、号码、姓名、用水电、煤气量,又定义了缴费函数Get(),用在有些人缴费函数体中,从键盘输入缴费用,一开始我们在Get(),中没有对缴费用进行累加,在查询信息时现实应缴费用不正确,经过我们努力,检验犯错误并加以更正,让程序愈加完善。2.用Feebz类派生出StuMan和|TeaMan类,其中有计算应该缴费用,StuMan类比TeaMan类多了无偿。3.在保留文件处理中,需考虑到“查询失败”和“重新输入”等很多内容三、关键步骤描述:水 电 气 管 理 系 统选操作对象退 出 系 统教 师学 生选择操作对象缴 纳 水 电 气 费查询一个学生水电气用量查询全部学生交费情况增 加 学 生 信 息删 除

5、学 生 信 息退出 系 统缴纳水电气费查询一个老师水电用量查询全部老师缴费情况增加教师信息删除教师信息退出系统退 出退 出 系 统步骤图:选择操作对象 四、使用说明:程序运行后,进入界面:在如上所表示界面下,依据提醒进行基础操作。五、 问题及处理方法问题1. 认为该系统不足就是不能够实现查看某个人用水量、用电量或用气量中一个和应该支付钱。问题2还有一个不足就是程序感觉不够简练,有点罗嗦。处理方法:对于处理这些问题,认为应该定义子函数来提取每个人信息这么就能够实现查看某人用水量、用电量、或用气量一个和应该支付钱。对于问题2这需要有扎实基础功,能全部用最简短源程序代码去处理一个相同问题。六、 实践

6、总结:课程设汁过程中碰到了很多麻烦,即使我早有心理准备,但还是令我伤透了脑筋,只怪自己平时看书太少,其实有很多东匹在书上全部能够找到答案,可是还是有部分问題我实在没有措施处理,最终经过老师和同学们努力处理了一个又一个问题。经过这次课程设计,我学习到了很多知识,而且给了我一个星月时间去重新认真有目标性C+语言进行复习,查找补漏,为后续课程做充足准备。设计过程是困难,因为以前没有类似经验刚开始几天没有太多进展,不过我们没有气馁,经过认真思索和老师帮助,最我们有了很好设设计方法。程序完成使我们很快乐,全部疲惫己经不算什么了,现在认为要想编写一个好程序真很累,它需要牢靠基础知识作为 铺垫,全部源代码编

7、写输入和每一步调试全部容不得一点马虎,整个牢靠基础是编程最基础需要,要想好每一步算法,要想到每一个对应函数。我认为一月课程设计远远比我自己看一学期书 收获多,实践是检验知识最隹手段。七、 源代码:#include #include #include #include #include using namespace std; int ns,nt; class Feebz / 学生信息类 public: Feebz(string Num=,string Name=董金明, double water=1,double power=0,double gas=10); / 结构函数 friend os

8、tream &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(); outsetw(8)leftr.GetG(); outsetw(8)leftr.GetTotal(); if(r.flag) out已交; else out未交; return ou

9、t; void operator =(Feebz 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; ; Feebz:Feebz(string Num,string Name, double Wate

10、r, 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.gas; double Feebz:GetW() / 计算学生水费 if(water=6) Waterprice=0; else Waterprice=0.6*(water-6);

11、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); return Powerprice; class StuMan / 学生管理类 public: StuMan(int sz=50) size=sz; St=new Feebzsize; /

12、结构函数 StuMan() delete St; / 析构函数 void MainMenu(); / 主菜单 void FeeMenu(); / 学生交费菜单 void NumFee(); / 输入学号交费void NameFee(); / 输入姓名交费 void CheckMenu(); / 学生查询菜单 void NumCheck(); / 输入学号查询 void NameCheck(); / 输入姓名查询 void Add(); / 增加学生功效 void DeleteMenu(); / 学生删除菜单 void NumDelete(); / 输入学号删除 void NameDelete(

13、); / 输入姓名删除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 欢 迎 使 用 教 师 水 电 气 费 管 理 系 统endl; cout 1.缴纳水电气费endl; cout 2.查询一个同学水电气费用量endl; cout 3.查看全部同学缴费情况en

14、dl; 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:DeleteMenu(); break; default: break; if(choice=6) break; void StuMan:Regist() int i=0; ifstream tfile

15、(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 endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 学 生 交 费 菜 单endl; cout 1.根据学号交费endl; cou

16、t 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) break; void StuMan:NumFee() / 输入学号交费 string number; float money; int flag=0,flag1=0; cout欢迎使用交费

17、功效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 cout该同学交费成功,且找零钱为money-Sti.GetTotal()元endl; Sti.flag=1; MainMenu(); break; if(!flag1) system(cl

18、s); 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该同学应该交费共Sti.GetTotal()元endl; coutmoney; if(moneySti.GetTotal() cout该同学需再补交Sti.GetTotal()-money元endl;

19、 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() / 学生查询菜单 system(cls); int choice; cout endl; cout endl; cout 水电煤气管理系统 endl; cout endl; cout endl; cout 学 生

20、查 询 菜 单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); MainMenu(); break; default:exit(1); if(choice=3) break; void StuMan:NumCheck() / 输入学号查询 string number

21、; 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该学生学号输入错误,请重新使用该功效!endl; NumCheck(); void StuMan:NameCheck() / 输入姓名查询 string name; int flag1=0

22、,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该学生学号输入错误,请重新使用该功效!endl; NameCheck(); void StuMan:DeleteMenu() / 学生删除菜单 system(cls); int choice; cout endl; cout en

23、dl; 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; case 2:NameDelete(); break; case 3:system(cls); MainMenu(); break; default:exit(1); if(choice=3)

24、 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该学生信息已被删除!endl; if(item) system(cls); cout该学生学号输入错误,请重新使用该功效!endl; NumDelete(); void StuMan:NameD

25、elete() / 输入姓名删除 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) system(cls); cout该学生姓名输入错误,请重新使用该功效!endl; NameDelete(); void StuMan:Add() / 增加学生功效 int n,i,j=1; coutn; i

26、=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学号 姓名 用水量用电量用煤气量 水费 电费煤气费 总额 交费否endl; for( i=0;ins;i+) if(Sti.flag) coutSti; coutendl; coutendl; coutendl; cout未交费学生信

27、息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) ; friend ostream &operator (ostream &out,TFeebz &r) / 运算符重载 outsetw(12)leftr.number; outsetw(8)leftr.name; outsetw(8)leftr.water; out

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服