Update the first program. Use a for loop to process the data for 5employees. Upd
ID: 3619094 • Letter: U
Question
Update the first program. Use a for loop to process the data for 5employees. Update the output as shown in the sample data. Usearrays to store the variable data. In the for loop, if any of theentered fields are –1, break out of the loop.Example (Sample input & output for one person)
Enter name: Glenn
Enter hourly rate: 2.00
Enter hours worked: 50
Pay to: Glenn
Hours worked: 50.0
Hourly rate: $ 2.00
Gross pay: $110.00
Base pay: $ 80.00
Overtime pay: $ 30.00
Taxes paid: $ 22.00
Net pay: $ 88.00
------------------
1st program:
#include <stdio.h>
#include <conio.h>
int main()
{int i;
double rate, hours, tax, salary,paid;
char name[10];
for(i=0;i<5;i++)
{printf("Enter name: ");
scanf("%s",&name);
printf("Enter hourly rate: ");
scanf("%lf",&rate);
printf("Enter hours worked: ");
scanf("%lf",&hours);
printf("Pay to: %s ",name);
printf("Hourly rate: %.2f ",rate);
printf("Hours worked: %.2f ",hours);
if(hours>40)
{salary=rate*40;
hours-=40;
salary=salary+(hours*(rate*1.5));
}
else
salary=hours*rate;
tax=salary*.2;
paid=salary-tax;
printf("Salary before taxes:$%.2f ",salary);
printf("Taxes paid: $%.2f ",tax);
printf("Amount paid: $%.2f ",paid);
}
getch();
return 0;
}