If the condition at this step turns out to be false

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: Sexcode that can have values M (for male) or F (for female). We want to make a list of only those female students who have passed in second division (obtained 45% or more but less than 60% marks). In the end we also want to print out the total number of such students. Assuming that the input data of all the students is terminated by a trailer record that has a sentinel value of Z for Sexcode, draw a flowchart for the algorithm to do the above job. Solution: The flowchart in Figure 11.9 is a solution to this problem. There are four decision symbols in this flowchart. The first one checks for a trailer record by comparing Sexcode against the value Z to determine if processing is complete. The second one is used to check whether the candidate is female or not by comparing the Sexcode of that candidate against F. Note that if the Sexcode is not F, that is, the candidate is not a female, we do not process the data of that student and return back to perform the operation of reading input data. This step ensures that the data of only female students will be taken for further processing. The last two decision symbols in the flowchart are used to check whether the student has passed in second division or not. The first of these decisions is used to ensure that the student has scored 45% or more marks. If she has scored less than 45% then it means that she is not a second divisioner and hence without making any further check we return back to the operation of reading input data. In case the student has scored 45% or more marks then we go one step further in the logic and by using the fourth decision in the flowchart we check whether her marks are less than 60% by comparing the Percentage against 60. If the condition at this step turns out to be false then it means that the student has scored 60% or more marks and hence she is a first divisioner and not a second divisioner. So once again we return back to read a new data without writing any output data. If the condition inside the fourth decision symbol turns out to be true then the female candidate c...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online