Hey, I need Help with this program I'm doing. I need it to assign regular pay for a person that works 40 hours or less and over time hours at a rate of time and a half for any hours over 40. My PROBLEM is when i put any hours over 40, it calculates the total hours as 40 only and outputs gross, taxes, etc. based on 40 hours...What is wrong here?
#define CB cin.ignore(cin.rdbuf()->in_avail())
#define Max 3 // Maximum Employees
#include<iomanip.h>
#include<stdlib.h>
#include<math.h>
main()
{//_asm finit;
int Hour, Emp; char Name[20], SocSec[11];
float PayRate,OTRate=PayRate*1.5, StateRate;
float FedRate, Gross=0, StTax,FedTax,Net,OvrTime,RegPay;
for(Emp=1;Emp<=Max;Emp++)
{cout<<"\nEmployee Number : "<<Emp;
cout<<"\nEnter Name : ";cin.getline(Name,20);CB;
cout<<"Enter Social Security Number: ";cin.getline(SocSec,11);CB;
cout<<"Enter Number of Hours worked: ";cin>>Hour;CB;
cout<<"Enter Pay Rate (Hourly) : ";cin>>PayRate;CB;
cout<<"Enter State Tax Rate : ";cin>>StateRate;CB;
cout<<"Enter Federal Tax Rate : ";cin>>FedRate;CB;
RegPay=40*PayRate;
OvrTime=((Hour-40)*OTRate);
StTax=Gross*StateRate;
FedTax=Gross*FedRate;
Net=Gross-(StTax+FedTax);
if(Hour<=40)
{Gross=Hour*PayRate;}
else
{Gross=((RegPay)+((Hour-40)*OTRate));}
cout.setf(ios::floatfield,ios::showpoint);
cout.setf(ios::fixed);
cout<<setprecision(2);
cout<<"\nName : "<<Name;
cout<<"\nSSN : "<<SocSec;
cout<<"\nPay Rate (Hourly): $"<<PayRate;
cout<<"\nState Tax Rate : $"<<StateRate;
cout<<"\nFederal Tax Rate : $"<<FedRate;
cout<<"\nState Taxes : $"<<StTax;
cout<<"\nFederal Taxes : $"<<FedTax;
cout<<"\nGross Pay : $"<<Gross;
cout<<"\nRegular Pay : $"<<RegPay;
cout<<"\nOvertime Pay : $"<<OvrTime;
cout<<"\nNet Pay : $"<<Net<<endl;
}
system("PAUSE");
return 0;
}
Thanks for any Help