Hello,
I know i'm suppose to ask programming questions but i'm stuck on how to do it in the first place, the question is:
You are given 4 information-gross pay, number of extra hours worked, the hourly pay rate, and the income tax rate. Calculate the overtime payment:
Overtime payment = extra hours worked * hourly pay rate - deductions
Deduction = social security + income tax + union dues totaling 5.00
Social security = 8.5% of the gross pay
Income tax = rate of tax * gross pay
I finish the code but the final answer which is 'overtime payment' i'm getting a negative value. I'm not sure if I went wrong in input or what, but I need some help on what the input should be. Thanks.
#include<iostream>
using namespace std;
double social(double security);
int uniondue = 5;
int main()
{
double gross,hours,tax;
double overtime=0;
double deduction=0;
int rate;
cout<<"****Xstyle Company****"<<endl;
cout<<"Gross Pay: ";
cin>>gross;
cout<<"Number of extra hours worked: ";
cin>>hours;
cout<<"Hourly pay rate: ";
cin>>rate;
cout<<"Income tax rate(%): ";
cin>>tax;
tax = (tax/100)*gross;
cout<<tax<<endl;
deduction = social(gross) + tax + uniondue;
cout<<deduction<<endl;
overtime = (hours * rate) - deduction;
cout<<overtime;
return 0;
}
double social(double security)
{
security = (0.085) * security;
return (security);
}