Skip to content

Instantly share code, notes, and snippets.

@edenizk
Created May 11, 2018 16:58
Show Gist options
  • Select an option

  • Save edenizk/5e7908c763e1b9e84a103310e2bff7fe to your computer and use it in GitHub Desktop.

Select an option

Save edenizk/5e7908c763e1b9e84a103310e2bff7fe to your computer and use it in GitHub Desktop.
salary calculator
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int BS,NH,HR,OV,CP,x,y,a,k;
cout<<"enter how many hours you worked this week:";
cin>>NH;
cout<<endl;
cout<<"enter hours rate: ";
cin>>HR;
cout<<endl;
BS=NH*HR;
if (NH>42){
BS=42*HR;
OV=NH-42;
x=OV*2;
CP=x+BS;
}
else if (NH<=42){
BS=NH*25;
CP=BS;
}
y=CP*52;
cout<<"your annual salary: "<<y<<endl;
if(y<=20000){
a=(y/100)*19;
cout<<"your tax rate 19%"<<endl;
}
else if (y>20000&&y<30000){
a=(y/100)*21;
cout<<"your tax rate 21%"<<endl;
}
else if (y>30000){
a=(y/100)*28;
cout<<"your tax rate 28%"<<endl;
}
k=y-a;
cout<<"your wage after tax deduction: "<<k<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment