◾Use output statements to display input data and calculation results; display decimal values formatted to two decimal places. This is where I am having difficulties! Everything else has been done for this particular project so for example when u use 4.4444 for pay rate and 10 for hours it should print out that regular pay is 44.44! not 44.444!
{
// declare variables
int Id = 0;
double hours = 0.00;
double payrate = 0.00;
char ucode = 'A';
double rpay = 0.00;
double opay = 0.00;
double gpay = 0.00;
double ftax = 0.00;
double npay = 0.00;
cout <<"\nWelcome Please Enter Employee Info";
//Input Data from keyboard
cout << "\nEnter Employee's ID ";
cin >> Id;
cout << "\nEnter Employee's Hours worked ";
cin >> hours;
cout << "\nEnter Employee's Pay Rate $";
cin >> payrate;
cout << "\nEnter Employee's union code ";
cin >> ucode;
cout << "\nEmployee's Id " << Id << "\nEmployee's Hours " << hours << "\nEmployee's Payrate " << payrate << "\nEmployee's Union Code " << ucode;
//Calculate regular pay and/or overtime pay.
if ( hours <= 40 ){
rpay = hours * payrate;
gpay = rpay;
cout<< "\nGross pay is $" << gpay;}
if ( hours > 40 ){
rpay = 40 * payrate;
opay = payrate * (1.5 *(hours-40));
gpay = rpay + opay;
cout<< "\nGross pay is $" << gpay;}
//Calculate the Gross Pay.
if ( gpay <= 1000 ) {
ftax = .10 * gpay;
cout << "\nThe Federal tax due is $" << ftax;
}
else if ( gpay > 1000 && gpay <= 2000){
ftax = .15 * gpay;
cout << "\nThe Federal tax due is $" << ftax;
}
else if ( gpay > 2000){
ftax = .25 * gpay;
cout << "\nThe Federal tax due is $" << ftax;
}
//Calulating Netpay.
switch ( ucode )
{
case 'A' : cout << "\nEmployee owes $25 to Union ";
npay = (gpay - (ftax + 25));
cout << "\nEmployee's Net Pay is $" << npay;
break;
case 'a' : cout << "\nEmployee owes $25 to Union ";
npay = (gpay - (ftax + 25));
cout << "\nEmployee's Net Pay is $" << npay;
break;
case 'B' : cout << "\nEmployee owes $50 to Union ";
npay = (gpay - (ftax + 50));
cout << "\nEmployee's Net Pay is $" << npay;
break;
case 'b' : cout << "\nEmployee owes $50 to Union ";
npay = (gpay - (ftax + 50));
cout << "\nEmployee's Net Pay is $" << npay;
break;
case 'C' : cout << "\nEmployee owes $75 to Union ";
npay = (gpay - (ftax + 75));
cout << "\nEmployee's Net Pay is $" << npay;
break;
case 'c' : cout << "\nEmployee owes $75 to Union ";
npay = (gpay - (ftax + 75));
cout << "\nEmployee's Net Pay is $" << npay;
break;
default:
cout << "\nThere is no such Union Code ";
npay = (gpay - (ftax + 0));
cout << "\nEmployee's Net Pay is $ " << npay;
}
cout << "\nThank You for using our software, Please Enjoy the rest of your Day! \n ";