Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You need a program to maintain information about your employees\' payroll. Assum

ID: 3792381 • Letter: Y

Question

You need a program to maintain information about your employees' payroll. Assume that you have the following employees: Write a C program that will perform the following tasks: Task 1: Allow the user to enter in the data for each employee. (The user will not enter the $ or % symbols.) Task 2: For each employee, calculate the gross pay, the federal tax owed, the state tax owed, and the net pay. The formulas to use are as follows: gross pay = hours worked * hourly rate (do not worry about an overtime bonus for this program.) federal tax owed = gross pay * federal tax rate/100 state tax owed = gross pay * state tax rate/100 net pay = gross pay - federal tax owed - state tax owed Task 3: Print out the name for each employee followed by the results of your four calculations from Task 2. Task 4: Calculate and print the total gross pay, the total federal tax owed, the total state tax owed, and the total net pay for all four of the employees.

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
float gp[4],ftr[4],str[4];
struct Employee{
   float HWorked,HRate,FTRate,STRate;
   char name[20];
};

int main(int argc, char *argv[]) {
   struct Employee emp[4];
   float grossPay,fTaxOwed, sTaxOwed,netPay;
   int i,j;
   for(i = 0; i < 4; i++){
       printf(" EMPLOYEE %d details ",i+1);
   printf("Enter Employee Name:");
   scanf("%s",&emp[i].name);
   printf("Enter hours worked:");
   scanf("%f",&emp[i].HWorked);
   printf("Enter hourly rate:");
   scanf("%f",&emp[i].HRate);
   printf("Enter Federal Tax rate:");
   scanf("%f",&emp[i].FTRate);
   printf("Enter State Tax rate:");
   scanf("%f",&emp[i].STRate);
  
   grossPay = emp[i].HWorked * emp[i].HRate;
   fTaxOwed = grossPay * emp[i].FTRate / 100;
   sTaxOwed = grossPay * emp[i].STRate / 100;
   netPay = grossPay - fTaxOwed - sTaxOwed;
   gp[i] = grossPay;
   ftr[i] = fTaxOwed;
   str[i] = sTaxOwed;
  
   printf(" Name of the Employee: %s ",emp[i].name);
   printf(" Gross Pay: %f ",grossPay);
   printf(" Federal Tax Rate: %f ",fTaxOwed);
   printf(" State Tax Rate: %f ",sTaxOwed);
   }  
   totalGrossPay();
   return 0;
}

void totalGrossPay(){
   float gp_total = 0.0,ftr_total = 0.0,str_total = 0.0;
   int i;
   for(i = 0; i < 4; i++){
       gp_total = gp_total + gp[i];
   }
   for(i = 0; i < 4; i++){
       ftr_total = ftr_total + ftr[i];
   }
   for(i = 0; i < 4; i++){
       str_total = str_total + str[i];
   }
   printf(" total gross pay for all the employees: %f ",gp_total);
   printf(" total federal tax rate for all the employees: %f ",ftr_total);
   printf(" total state tax rate for all the employees: %f ",str_total);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote