📄 salary.cpp
字号:
#include <iostream.h>
#include <iomanip.h>
#include "salary.h"
salary::salary()
{
base=0;
allowance=0;
postpay=0;
subsidy=0;
housep=0;
traffic=0;
rent=0;
saving=0;
fee=0;
mon=MAY;
}
salary::salary(float b,float a,float pst,float s,float h,
float tra,float rnt,float save,float fe)
{
base=b;
allowance=a;
postpay=pst;
subsidy=s;
housep=h;
traffic=tra;
rent=rnt;
saving=save;
fee=fe;
mon=MAY;
}
void salary::setmonth(MONTH month)
{
mon=month;
}
float salary::setbase(float bas){return base=bas;}
float salary::setallo(float allo){return allowance=allo;}
float salary::setpst(float pst){return postpay=pst;}
float salary::setsub(float sub){return subsidy=sub;}
float salary::sethouse(float hous){return housep=hous;}
float salary::settra(float tra){return traffic=tra;}
float salary::setrent(float ren){return rent=ren;}
float salary::setsave(float save){return saving=save;}
float salary::setfee(float fe){return fee=fe;}
float salary::getbase(){return base;}
float salary::getallo(){return allowance;}
float salary::getpst(){return postpay;}
float salary::getsub(){return subsidy;}
float salary::gethouse(){return housep;}
float salary::gettra(){return traffic;}
float salary::getrent(){return rent;}
float salary::getsave(){return saving;}
float salary::getfee(){return fee;}
float salary::gettax()
{
if(base<800)
tax=0;
else if(base>=800 && base<1000)
tax=base*float(5.0/100.0);
else if(base>=1000 && base<5000)
tax=base*float(10.0/100.0);
else if(base>=5000)
tax=base*float(20.0/100.0);
return tax;
}
float salary::getyf()
{
yingfu=base+allowance+postpay+subsidy+housep+traffic;
return yingfu;
}
float salary::getde()
{
deduce=rent+saving+fee+tax;
return deduce;
}
float salary::getpay()
{
pay=yingfu-deduce;
return pay;
}
void salary::display()
{
cout<<"month gz jt gt ft jtbt\n";
cout<<mon<<' '<<base<<' '<<allowance<<' '<<postpay<<' '
<<subsidy<<' '<<housep<<' '<<traffic<<endl;
cout<<"fz chuxu huifei gerensuodesui"<<endl;
cout<<rent<<' '<<saving<<' '<<fee<<' '<<tax<<endl;
cout<<" yingfa yingkou shifa"<<endl;
cout<<yingfu<<' '<<deduce<<' '<<pay<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -