0

Can somebody tell me whats wrong with this codes? I’d try to write this program but have error. I don’t how to make it correctly. Please help me!

-da question-
Write a program to process weekly employee time cards for all employees of an organization.
Each employee will have three data items:
• an identification number.
• the hourly wage rate.
• the number of hours worked during a given week.
Each employee is to be paid time and a half for all hours worked over 40, A tax amount of 3.625 percent of gross salary will be deducted. The program output should show the employee’s number and net pay. Display the total payroll and the average amount paid at the end of the run.

THIS IS WHAT I DID…

#include<stdio.h>
#define tax 0.03625

double calculation(double hours, double H_W_Rate);   /* Function prototype */

int
main(void)
{   /* variable declaration */
    double pay, 
		   no_worker,   
		   ave_pay,   
		   ID,   
		   H_W_Rate,   
		   hours,    
		   N_Worker,    
		   net_pay,  
		   salary;
	
    /* Get the number of employee */
    printf("Please please enter number of employee(s):- \n"); 
    scanf("%lf", &no_worker);
    salary = 0.0;

	do{
    		N_Worker = 0; 
			printf("\nPlease enter employee's ID:- \n");
            scanf("%lf", &ID);
            printf("Please enter the hourly wage rate:- \n");	
            scanf("%lf", &H_W_Rate);
            printf("Please please enter the numbers of hours worked during a given week:- \n");
            scanf("%lf", &hours);	
			printf("The net payment for this employee is RM%6.2f\n", net_pay);	

			printf("\nAll employees processed.\n");
            printf("the salary is %8.2f\n", salary); 
            printf("Average amountpaid is RM%6.2f\n", ave_pay);


            N_Worker = N_Worker + 1;
            pay = calculation(hours, H_W_Rate);
            salary = salary + pay;
            ave_pay = salary / N_Worker;
            net_pay = pay - (pay * tax);

			/* Calculation for the pay */
			double   pay;
			if(hours <= 40) {
			pay = hours * H_W_Rate;
			}
			else 
			{
			pay = (40 * H_W_Rate) + (hours - 40) * 1.5;
	}
			)while(hours != 0);
			return 0;
	}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by VernonDozier
0

Code tags please:

[code]

// paste code here

[/code]

Also, is this C or C++? You have printf , scanf , and stdio.h . If it's C, there is a C forum on Daniweb.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.