Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

C program to calculate net pays

839 views

Published on

calculate for net pays of employees in a company. very educate for those starting c programming coding

Published in: Business, Technology, Design
  • Be the first to comment

  • Be the first to like this

C program to calculate net pays

  1. 1. MAKERERE UNIVERSITY SCHOOL OF STATISTICS AND PLANNING DEPARTMENT OF STATISTICAL METHODS BACHELOR OF STATISTICS AND BACHELOR OF SC IN ACTUARIAL SCIENCE 2011/2012 GROUP 10
  2. 2. TASK • A given organisation has 30 employees with a policy of no increase nor decrease in the number of staff. You are required to design a computer program that computes the net pay of employees. Note that the system requires the following • Identification number of employees • Name of employees • Sex • Department • Gross pay • Birth day of employees • Etc • Note tax = 30% of the gross pay
  3. 3. REQUIRED • A company requires a data base of its employees with all the details of the employees including the gross pay • A computer program that computes the net pay of employees putting into consideration the gross pay and the tax rate of employees • Note, in Uganda employees earning bellow shs.130000 do not pay tax, in our program we considered employees earning a gross pay bellow shs.200000 do not pay tax
  4. 4. CHOICES AND DECISIONS • We decided to use c programming language when designing the program that computes the net pay because of the following 1. C language is simple to learn and adopt to. 2. C language is portable, a program can be designed on one system and be used on a different system
  5. 5. STEPS IN DESIGNING THE PROGRAM • After designing a database system of the 30 employees, we were in position to design the program • We calculated the tax paid by each employee putting into consideration the gross pay earned i.e. gross pay > 200000 Tax paid= 0.3 * gross pay While gross pay < = 200000 Tax paid = shs.0
  6. 6. CONTINUATION • After calculating the tax paid by each employee, We calculate the net pay of the employees i.e. net pay = gross pay – tax paid • from the above employees earning shs.200000 and below do not pay tax and there fore their Net pay = gross pay
  7. 7. C TECHIQUES USED • In the program we used a “for” loop to control the number of employees to which the net pay is calculated. • All the details of the employee as got from a database of the company are entered in the main function under the “for” loop, like the name , sex and gross pay • Our for loop statement has three parts, the part that initialises the employee, its executed, then the second condition if its true, the loop continues i.e. if the number of employees is still less than 30, when the second condition is wrong, the program exits the loop.
  8. 8. CONTINUATION OF THE TECHIQUES • The “for” loop statement is nested as it contains the “if” statement in it. • The use of the “if ” statement is to control the calculation of net pay, as it contains a Boolean statement i.e. gross>200000 where if the conditions is true, the calculation of the net pay is executed but when the condition is false the calculation are not executed as shown above.
  9. 9. PROGRAM CYCLE • Including a header statement. • Initialising the size of employees to be considered • Declaring local variables to be used in the program • Introducing the main function, and in the main function we declared a “for” loop and an if condition in it • Entering the employee data form the data base i.e. name, sex, department, gross pay.
  10. 10. • At the if condition we check whether the gross pay is greater than 200000 and if yes tax is calculated and net pay got by subtracting the tax paid from gross pay When the gross pay is less than 200000 or equal to 200000, the tax paid is zero(0) and thus the net pay equals to the gross pay At the end the program prints the name department and gross pay plus net pay in tabulat form.
  11. 11. CONCLUSION • From above the program calculates the net pay of the employees putting into consideration the gross pay, • The program is case sensitive on the amount earned by each employees as those earning shs.200000 and below

×