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

I need some help with this code. If you could supply the code for me to referenc

ID: 644655 • Letter: I

Question

I need some help with this code. If you could supply the code for me to reference off of it would be much appreciated!

Change the code posted for program 4(or your code for program 4 if it is 100% correct) as follows:

Create functions and prototypes to perform each of the actions required by each menu option with the exception of program exit.

All user input other than menu choice should be handled inside the functions.

All output should be performed by each of the functions.

All array changes should be done inside the functions.

Here is Program 4:

Explanation / Answer

#include<stdio.h>

int functionA(double employee[4][20], int count){
   if (count <= 19)
    {
        printf("please enter employee number: ");
        scanf("%lf", &employee[0][count]);
        printf("Please enter employee hours worked: ");
        scanf("%lf", &employee[1][count]);
        printf("Please enter emloyee hourly rate");
        scanf("%lf", &employee[2][count]);
        printf("please enter employee tax deduction percentage: ");
        scanf("%lf", &employee[3][count]);
        count++;
    }
    else
       printf("Array full, cannot add employee");
    return count;
}

void functionD(double employee[4][20], int count){
   int number, j;
   printf("Please enter employee number: ");
    scanf("%d", &number);
    for (j = 0; j <= count-1; j++)
        if ( number == (int)employee[0][j])
        {
            printf(" ");
            printf("Emloyee number    : %6.0lf ", employee[0][j]);
            printf("Employee hours    : %.2lf ", employee[1][j]);
            printf("Emplyee pay rate : %.2lf ", employee[2][j]);
            printf("Emplyee tax deduct: %.2lf ", employee[3][j]);
            printf("employee total pay: %.2lf ", employee[1][j]*employee[2][j]*(100 - employee[3][j])*0.01);
        }
       else
           printf("no employee with number %d", number);
}

void functionT(double employee[4][20], int count){
   double sum = 0;
   int j = 0;
   for (j = 0; j <= count; j++)
        sum = sum + employee[1][j]*employee[2][j]*employee[3][j]*0.01;
    printf("The total payrol is : %.2lf", sum);
}

void functionS(double employee[4][20], int count){
   int j = 0;
   for (j = 0; j <= count-1; j++)
    {
        printf(" ");
        printf("Emloyee number    : %6.0lf ", employee[0][j]);
        printf("Employee hours    : %.2lf ", employee[1][j]);
        printf("Emplyee pay rate : %.2lf ", employee[2][j]);
        printf("Emplyee tax deduct: %.2lf ", employee[3][j]);
        printf("employee total pay: %.2lf ", employee[1][j]*employee[2][j]*(100 - employee[3][j])*0.01);
    }
}

int main(void)
{
   double employee[4][20]= {0};
   char menu = ' ';
   int count = 0;
   int j = 0;
   int number = 0;
   double sum = 0;

   do
   {
      printf(" please choose from the following menu ");
      printf("Choose              to                ");
      printf("----------------------------------------- ");
      printf(" a or A          enter employee info    ");
      printf(" d or D          display employee info ");
      printf(" t or T          display total payrol   ");
      printf(" s or S          display all info       ");
      printf(" z or Z                 exit            ");


      printf("Please enter menu choice: ");
      scanf(" %c", &menu);

      switch (menu)
      {
    
         case 'a': case 'A':
            count = functionA(employee, count);
            break;
    
         case 'd': case 'D':
            functionD(employee, count);
            break;
    
         case 't': case 'T':
            functionT(employee, count);
            break;
    
         case 's': case 'S':
            functionS(employee, count);
            break;
    
         case 'z': case 'Z':
            return 0;
            break;
    
         default :
            printf("please enter a valid menu option");
            break;
      }

   }while(1);

   return 0;
}