欢迎来到天天文库
浏览记录
ID:57064672
大小:61.50 KB
页数:6页
时间:2020-07-31
《C++程序设计题目源码(实验二).doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验题目(共4题,第1题)标题:1.函数重载时 限:3000 ms内存限制:10000 K总时限:3000 ms描述: 设计一菜单程序,利用函数重载实现员工月工资的计算,计算方法如下: (1)管理人员的月工资=月薪-缺勤天数 ×月薪 ÷22; (2)销售人员的月工资=底薪+销售金额×提成比例; (3)计件工人的月工资=产品件数 ×每件报酬; (4)计时工人的月工资=工作小时×小时报酬;输入:职工类别及相关信息。职工类别:1表示管理人员;2表示销售人员;3表示计件工人;4表示计时工人;其余字符表示退出。相关信息:若为管理人员,则输入月薪和缺勤天数;
2、若为销售人员,则输入底薪、销售金额和提成比例;若为计件工人,则输入产品件数和每件报酬;若为计时工人,则输入工作小时和小时报酬。输出:员工月工资。输入样例:1 〈--职工类别5000.01〈--月薪和缺勤天数输出样例:4772.73提示:1.计算管理人员、销售人员、计件工人、计时工人的月工资的函数原型可以分别设计如下: doublegetEarning(doublesalary,intabsenceDays); doublegetEarning(doublebaseSalary,doublesalesSum,doublerate)
3、; doublegetEarning(intworkPieces,doublewagePerPiece); doublegetEarning(doublehours,doublewagePerHour);2.菜单程序设计如下: intmain(){ ... cout<<"Pleaseselect..."<4、Worker."<>sel; switch(sel) { case1: cin>>...; cout<>...; cout<>...; cout<5、 case4: cin>>...; cout<·usingnamespacestd;··doublegetEarning(doublesalary,intabsenceDays)·{·returnsalary-salary*absenceDays/22;·}·doublegetEarning(doublebaseSalary,doubl6、esalesSum,doublerate)·{·returnbaseSalary+salesSum*rate;·}·doublegetEarning(intworkPieces,doublewagePerPiece)·{·returnwagePerPiece*workPieces;·}··doublegetEarning(doublehours,doublewagePerHour)·{·returnhours*wagePerHour;·}···intmain()·{·cout<<"Pleaseselect..."<7、Manager."<>sel;·switch(sel)·{·case1:·doublesalary;·intabsenceDays;·cin>>salary>>absenceDays;·cout<8、2:··doublebaseSalary,salesSum,rate;·cin>>baseSalary>>salesSum>>rate;
4、Worker."<>sel; switch(sel) { case1: cin>>...; cout<>...; cout<>...; cout<5、 case4: cin>>...; cout<·usingnamespacestd;··doublegetEarning(doublesalary,intabsenceDays)·{·returnsalary-salary*absenceDays/22;·}·doublegetEarning(doublebaseSalary,doubl6、esalesSum,doublerate)·{·returnbaseSalary+salesSum*rate;·}·doublegetEarning(intworkPieces,doublewagePerPiece)·{·returnwagePerPiece*workPieces;·}··doublegetEarning(doublehours,doublewagePerHour)·{·returnhours*wagePerHour;·}···intmain()·{·cout<<"Pleaseselect..."<7、Manager."<>sel;·switch(sel)·{·case1:·doublesalary;·intabsenceDays;·cin>>salary>>absenceDays;·cout<8、2:··doublebaseSalary,salesSum,rate;·cin>>baseSalary>>salesSum>>rate;
5、 case4: cin>>...; cout<·usingnamespacestd;··doublegetEarning(doublesalary,intabsenceDays)·{·returnsalary-salary*absenceDays/22;·}·doublegetEarning(doublebaseSalary,doubl
6、esalesSum,doublerate)·{·returnbaseSalary+salesSum*rate;·}·doublegetEarning(intworkPieces,doublewagePerPiece)·{·returnwagePerPiece*workPieces;·}··doublegetEarning(doublehours,doublewagePerHour)·{·returnhours*wagePerHour;·}···intmain()·{·cout<<"Pleaseselect..."<7、Manager."<>sel;·switch(sel)·{·case1:·doublesalary;·intabsenceDays;·cin>>salary>>absenceDays;·cout<8、2:··doublebaseSalary,salesSum,rate;·cin>>baseSalary>>salesSum>>rate;
7、Manager."<>sel;·switch(sel)·{·case1:·doublesalary;·intabsenceDays;·cin>>salary>>absenceDays;·cout<8、2:··doublebaseSalary,salesSum,rate;·cin>>baseSalary>>salesSum>>rate;
8、2:··doublebaseSalary,salesSum,rate;·cin>>baseSalary>>salesSum>>rate;
此文档下载收益归作者所有