01 Iec t1s1 PLT Session 01 Part19

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

6/13/2012

Identifying Modular Approach to Programming (Contd.)


Flowchart shows the modules Accept & Average
Accept

Identifying Modular Approach to Programming (Contd.) Example:


The total expenditure on salaries for the month needs to be calculated. As per company policy an employee receives a minimum of $500. Depict the logic for automating the task by using flowcharts. The table shows the variables used in the flowchart.
Variable Employee code Data Type character numeric numeric character Variable Name cEmpCode nSalary nTotSalary cChoice

Accept cStudentName Accept Average Accept nTest1 nAverage=(nTest1+nTest2 +nTest3) / 3

Average

Accept nTest2

Accept nTest3 Display cStudentName, nAverage Is nTest1>=0 AND nTest2>=0 AND nTest3>=0 ? No Display Test score cannot be less than zero Yes

Return

Employee salary Total salary Choice


Return

Identifying Modular Approach to Programming (Contd.)


Flowchart to calculate total monthly expenditure on salaries

Identifying Modular Approach to Programming (Contd.)

Dry Run Table:


S. No.
Accept

nSalary 4500 5500 3400 5600 3000 5000 450 9000 8900 4500

nTotSalary 0 4500 10000 13400 19000 22000 27000 27000 36000 44900 49400

Output

1. 2.

Is cChoice = Y ?

No Accept nSalary

Summation

3. 4. 5.

Yes Accept Is nSalary >=500 ? Yes

nTotSalary=nTotSalary+nSalary

6. 7.

No Summation Display Salary cannot be less than $500

Return

Return

8. 9. 10. 11.

Salary cannot be less than $500

49400

19

You might also like