已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C+课程设计:教师工资管理系统课程设计内容:教师工资管理系统(1) 输入职工数据(包括:职工号,姓名,基本工资,补贴金额,奖励金额,扣除金额,实发工资等)保存在paid.txt文件中。注:其中实发工资=基本工资+补贴金额+奖励金额-扣除金额。(2) 能够查询某位职工的相关数额。(3)统计:分类汇总并输出所有职工的基本工资,补贴金额,奖励金额,扣除金额,实发工资的总金额和平均金额。四、课程设计要求:程序质量:l 贯彻结构化程序设计思想。l 用户界面友好,功能明确,操作方便;可以加以其它功能或修饰。l 用户界面中的菜单至少应包括“职工信息录入”、“信息查询”、“工资统计”、“退出”4项。l 代码应适当缩进,并给出必要的注释,以增强程序的可读性 #include #include #include #include using namespace std;const char* filename = paid.txt;class EmployeeDatapublic: EmployeeData():id(0),name(),salary(0.0),allowance(0.0),bonus(0.0),deduction(0.0) void Input(); void Print(); void Save() const; void Load(ifstream& fin); inline int Id() constreturn id; inline string Name() constreturn name; inline float Salary() constreturn salary; inline float Allowance() constreturn allowance; inline float Bonus() constreturn bonus; inline float Deduction() constreturn deduction; inline float NetPay() const return (salary+allowance+bonus-deduction);private: int id; / 职工号 string name; / 姓名 float salary; / 基本工资 float allowance; / 补贴 float bonus; / 奖金 float deduction;/ 扣除金额;void EmployeeData:Input() cout id; cout name; cout salary; cout allowance; cout bonus; cout deduction;void EmployeeData:Print() cout职工号: t idendl; cout姓名: t nameendl; cout基本工资:t salaryendl; cout补贴金额:t allowanceendl; cout奖励金额:t bonusendl; cout扣除金额:t deductionendl; cout实发金额:t NetPay()endl;void EmployeeData:Save() const ofstream fout; fout.open(filename, ios:app); fout id t namet salaryt allowancet bonust deductiont NetPay() id name salary allowance bonus deduction netpay; fin.close();class DataManagerpublic: DataManager()entries.clear(); DataManager()entries.clear(); /菜单 void DisplayMenu();private: / 录入 void Input(); /查询 void Search(); /统计 void Stat(); /默认构造函数 EmployeeData Find(int id) const; /添加 void Append(EmployeeData entry); /保存 void Save() const; /读取 void Load();private: vector entries;void DataManager:Input() cout 职工信息录入n请输入员工信息endl; EmployeeData entry; entry.Input(); Append(entry); cout endl;void DataManager:Search() cout 信息查询n请输入员工的职工号: id; EmployeeData found=Find(id); if(found.Id() = 0 & found.Name()=) cout 无此员工号: id endl; else found.Print(); cout endl;void DataManager:Stat() float s(0.0); float a(0.0); float b(0.0); float d(0.0); float p(0.0); unsigned int count(entries.size(); for(unsigned int i(0);icount;i+) s+=entries.at(i).Salary(); a+=entries.at(i).Allowance(); b+=entries.at(i).Bonus(); d+=entries.at(i).Deduction(); p+=entries.at(i).NetPay(); cout tt总金额t平均金额endl; cout -endl; cout 基本工资tsts/countendl; cout 补贴金额tata/countendl; cout 奖励金额tbtb/countendl; cout 扣除金额tdtd/countendl; cout 实发工资tptp/countendl; cout endl;EmployeeData DataManager:Find(int id) const EmployeeData res; for(unsigned int i(0);ientries.size();i+) if(entries.at(i).Id() = id) res = entries.at(i); break; / for return res; void DataManager:Append(EmployeeData entry) entries.insert(entries.end(), entry);void DataManager:Save() const ofstream fout; fout.open(filename, ios:app ); fout.clear(); / 重新保存 fout entries.size() t endl; /保存总数 fout.close(); for(unsigned int i(0);i count; entries.clear(); for(unsigned int i(0);icount;i+) EmployeeData entry; entry.Load(fin); Append(entry); fin.close();void DataManager:DisplayMenu() int opt(0); Load(); do cout 1.职工信息录入endl; cout 2.信息查询endl; cout 3.工资统计endl; cout 4
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中国变速箱第一轴市场调查研究报告
- 2025年中国两用拉力器市场调查研究报告
- 2025至2031年中国闭路监控器材行业投资前景及策略咨询研究报告
- 2025年聚氨酯耐用油底漆项目可行性研究报告
- 2025年石油公司油票管理系统项目可行性研究报告
- 2025年燃气超压切断阀项目可行性研究报告
- 2025年横梁总成项目可行性研究报告
- 惠州2025年广东惠州龙门县总医院第一批招聘编外人员25人笔试历年参考题库附带答案详解
- 2025年平纹桃皮绒面料项目可行性研究报告
- 2025年冲压模具项目可行性研究报告
- 涉密计算机保密培训
- 挂靠免责协议书范本
- 2024年浙江省五校联盟高考地理联考试卷(3月份)
- 在线心理健康咨询行业现状分析及未来三至五年行业发展报告
- 电动三轮车购销合同
- 淋巴瘤的免疫靶向治疗
- 炎症性肠病的自我管理
- 国防动员课件教学课件
- 《地理信息系统GIS》全套教学课件
- 技术序列学习地图(2023年)
- 中国银行(香港)有限公司招聘笔试真题2023
评论
0/150
提交评论