Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- //variable declarations
- int iEmpID;
- float fEmpRate, fEmpHours, fEmpOTHours, fEmpOTRate,
- fEmpOTPay, fGrossPay, fEmpTaxes, fNetPay,
- fTotalGross, fTotalTaxes, fTotalNet, fTotalOTHours, fTotalOTPay;
- fTotalGross = fTotalTaxes = fTotalNet = fTotalOTHours = fTotalOTPay = 0;
- char cYesNo;
- printf("Please enter your employee ID number: ");
- scanf("%d", &iEmpID);
- printf("Do you want to process employee records? (Y/N): ");
- scanf("%c", &cYesNo);
- while (scanf("%c", &cYesNo) != 'N') {
- printf("\nPlease enter your employee ID number: ");
- scanf("%d", &iEmpID);
- printf("Enter employee's rate of pay: ");
- scanf("%f", &fEmpRate);
- printf("Enter employee's worked hours: ");
- scanf("%f", &fEmpHours);
- if (fEmpHours <=40) {
- fGrossPay = fEmpRate * fEmpHours;
- }
- else {
- fEmpOTHours = fEmpHours - 40;
- fEmpOTRate = fEmpRate * 1.5;
- fEmpOTPay = fEmpOTRate * fEmpOTHours;
- fGrossPay = ((fEmpOTHours)*(fEmpOTRate)) + (fEmpRate *40);
- }
- fEmpTaxes = fGrossPay * 0.172;
- fNetPay = fGrossPay - fEmpTaxes;
- fTotalOTHours = fTotalOTHours + fEmpOTHours;
- fTotalOTPay = fTotalOTPay + fEmpOTPay;
- fTotalGross = fTotalGross + fGrossPay;
- fTotalTaxes = fTotalTaxes + fEmpTaxes;
- fTotalNet = fTotalNet + fNetPay;
- printf("\nThe employee's ID is: %d\n", iEmpID);
- printf("The employee's rate of pay was: %.2f\n", fEmpRate);
- printf("The employee's worked hours were: %.2f\n", fEmpHours);
- printf("The employee's worked OT hours were: %.2f\n", fEmpOTHours);
- printf("The employee's gross pay was: %.2f\n", fGrossPay);
- printf("The employee's OT pay was: %.2f\n", fEmpOTPay);
- printf("The employee's withheld taxes were: %.2f\n", fEmpTaxes);
- printf("The employee's net pay was: %.2f\n", fNetPay);
- printf("\nDo you want to continue processing records? (Y/N): ");
- scanf("%c", &cYesNo);
- }
- printf("\nThe accumulated OT hours were: %.2f\n", fTotalOTHours);
- printf("The accumulated OT pay was: %.2f\n", fTotalOTPay);
- printf("The accumulated gross pay was: %.2f\n", fTotalGross);
- printf("The accumulated taxes withheld were: %.2f\n", fTotalTaxes);
- printf("The accumulated net pay was: %.2f\n", fTotalNet);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement