It must be clear to the readers from these examples

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d = 50, if no, go to Step 2 Step 7: Print Toral_First_Division. Step 8: Stop. Example 11.2. There are 100 employees in an organization. The organization wants to distribute annual bonus to the employees based on their performance. The performance of the employees is recorded in their annual appraisal forms. ""Every employee's appraisal form contains his/her basic salary and the grade for his/her performance during the year. The grade is of three categories - 'A' for outstanding performance, 'B' for good performance and 'C for average performance. It has been decided that the bonus of an employee will be 100% of the basic salary for outstanding performance, 70% of the basic salary for good performance, 40% of the basic salary for average performance, and zero for all other cases. Write an algorithm to calculate and print the total bonus amount to be distributed by the organization. Algorithm: Step 1: Initialize Total_Bonus and Total_Employees_Checked to zero. Step 2: Initialize Bonus and Basic_Salary to zero. Step 3: Take the appraisal form of the next employee. Step 4: Read the employee's Basic_Salary and Grade. Step 5: If Grade = A, then Bonus = Basic_Salary. Go to Step 8. Step 6: If Grade = B, then Bonus = Basic_Salary x 0.7. Go to Step 8. Step 7: If Grade = C, then Bonus = Basic_Salary x 0.4. Step 8: Add Bonus to Total_Bonus. Step 9: Add 1 to Total_Employees_Checked. Step 10: If Total_Employees_Checked < 100, then go to Step 2. Step 11: Print Total_Bonus. Step 12: Stop. Programmers design algorithms like these to solve complex programming problems. It must be clear to the readers from these examples that even for very simple problems, the development of algorithms is not so simple as it might initially appear and requires some thinking. It may also be noted from the given examples that in order to solve a given problem, each and every instruction must be strictly carried out in a particular sequence. It is this fact, which a beginner to problem solving by computers f...
View Full Document

Ask a homework question - tutors are online