Question

Write the pseudocode for the following: A company needs to print pay-slips for its employees. Each record contains the following: a. number, b. name, c. hours, d. gender, and e. code. Each employee’s...

Write the pseudocode for the following: A company needs to print pay-slips for its employees. Each record contains the following: a. number, b. name, c. hours, d. gender, and e. code. Each employee’s gross pay must be calculated and deductions made on the following basis: CODE 1: Full-time employee: Rate R30 per hour Deductions: Men PAYE 15% of gross pay, Medical aid R200 Women PAYE 10% of gross pay Medical aid R100 CODE 2: Part-time employee: Rate R20 per hour Deductions: Men PAYE 10% of gross pay Women PAYE 5% of gross pay No medical aid for this category. Print out a pay-slip for each employee, showing all the employee details, gross pay, all the deductions, and the net pay. Processing continues until a number of zero is entered. Then print out: The total number of men who work full time. The total PAYE paid by women. The total amount paid out by the company to all its employees.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Pseudocode for calculating the pay slip of the employees of a company
Declaration
   number emp_num;
   string name;
   number hours;
   string gender;
   number code;
   number totalFullMen;
   number totalPayWomen;
   number total;
   number gross_pay;
   number deduction;
   number net_pay;
Start
   // initialize totalFullMen, totalPayWomen and total to 0
   totalFullMen = 0;
   totalPayWomen = 0;
   total = 0;
  
   print("Name Hours Gender Gross Pay Deduction Net Pay");
   // input employee number
   input emp_num;
   // check if employee number is non-zero
   while emp_num != 0
   do
       // input employee code, name , hours and gender
       input code, name, hours, gender;
       // if full time employee
       if code == 1 then
           gross_pay = hours*30;
           // if male employee
           if gender == "M" then
               totalFullMen = totalFullMen + 1;
               deduction = 0.15*gross_pay + 200;
           else
               deduction = 0.10*gross_pay + 100;
               totalPayWomen = totalPayWomen + (0.10*gross_pay); //calculate paye by women
              
           end if;
       else // part time employee
           gross_pay = hours*20;
           // if male employee
           if gender == "M" then
               deduction = 0.10*gross_pay ;
           else
               deduction = 0.05*gross_pay ;
               totalPayWomen = totalPayWomen + (0.05*gross_pay); //calculate paye by women
           end if;
       // calculate net pay  
       net_pay = gross_pay - deduction;
      
       total = total + net_pay;   //calculate total amount paid to all employees
       print(name,hours,gender,gross_pay,deduction,net_pay);
       input emp_num;
   end while;

   print("The total number of men who work full time : ",totalFullMen);
   print("The total PAYE paid by women : ",totalPayWomen);
   print("The total amount paid out by the company to all its employees : ",total);
  
              
End      
      

Add a comment
Know the answer?
Add Answer to:
Write the pseudocode for the following: A company needs to print pay-slips for its employees. Each record contains the following: a. number, b. name, c. hours, d. gender, and e. code. Each employee’s...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT