




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 夏季行车安全考题及答案
- 物理研究参考题目及答案
- 吉林省农安县新农中学2024届中考三模数学试题含解析
- 《穿靴子的猫》读后感
- 2025年安全员-C证证考试题库及答案
- 云南锡业职业技术学院《马克思主义中国化》2023-2024学年第二学期期末试卷
- 江西环境工程职业学院《动物生物学实验双语》2023-2024学年第二学期期末试卷
- 2025年江西省赣县三中高三毕业班第十七模历史试题含解析
- 长沙医学院《影视美术》2023-2024学年第二学期期末试卷
- 南昌航空大学科技学院《聚合物近代仪器分析》2023-2024学年第二学期期末试卷
- 2025年道路运输企业主要负责人安全考试练习题(100题)含答案
- 2025届福建省莆田高中毕业班第二次质量检测英语试题(原卷版+解析版)
- 2025春苏少版(2024)美术小学一年级下册第二单元《有趣的肌理》教学设计
- 2025年安徽财贸职业学院单招职业技能考试题库及完整答案一套
- 2025年安徽中医药高等专科学校单招职业适应性测试题库有答案
- 北京大学DeepSeek系列-DeepSeek与AIGC应用
- DeepSeek+DeepResearch-让科研像聊天一样简单(内含AI学术工具公测版)
- 2025年无锡职业技术学院单招职业倾向性测试题库完整版
- 2025年皖西卫生职业学院单招职业技能测试题库及答案1套
- 宋代农书研究出版对宋代农业研究的价值4篇
- 5.2《稻》教案-【中职专用】高二语文同步教学(高教版2023·拓展模块下册)
评论
0/150
提交评论