228k views
2 votes
Write a program that computes the monthly net pay of the employee for a steel factory. The input for this program is the hourly rate of pay, the number of regular and the overtime hour work. The tax-deductible rate is 20%. You need first to calculate the gross pay, which is the sum of the wages earned from regular hours and overtime hours, the overtime is paid at 1.5 times the regular rate. Then you subtract the tax from the gross pay to get the net pay of the employee.

User Bachr
by
6.1k points

1 Answer

5 votes

Answer:

#include<stdio.h>

int main()

{

float rate_of_pay,regular_hours,overtime_hours,grosspay,netpay,tax;

printf("Enter the Hourly rate of pay : ");

scanf("%f",&rate_of_pay);

printf("Enter the number of Regular hours : ");

scanf("%f",&regular_hours);

printf("Enter the number of Overtime hours : ");

scanf("%f",&overtime_hours);

grosspay=(regular_hours*rate_of_pay)+(1.5*overtime_hours*rate_of_pay);

netpay=grosspay-(grosspay*0.2);

printf("Employee's Gross pay = %f\\",grosspay);

printf("Tax = %f\\",0.2*grosspay);

printf("Employee's Net pay = %f\\",netpay);

return 0;

}

Note: The variables are declared as float, to support partial hours like 0.5,6.5 etc.

Step-by-step explanation:

User Paul Bica
by
5.8k points