Page 96 - Computer Science Class 11 Without Functions
P. 96

Start




                                              Input personal
                                                 details



                                                               False
                                                age>=18

                                                      True
                                               print issue a    print not eligible
                                              Voter's ID card   for Voter's ID card



                                                  Stop

                                     Fig 4.4: Flowchart to issue a voter's identity card if eligible

        Note that the flowchart in Fig 4.4 is an informal description for printing the Voter's ID using a machine. In practice,
        fetching personal information would require more refined information such as name, gender, date of birth, a declaration
        that the applicant is a citizen of India, and a photograph of the applicant. Similarly, printing the Voter's ID card would
        require printing the relevant information on a card of suitable size.
        Next, we write a pseudocode for the flowchart in Fig 4.4. First, we identify the inputs, output, and process informally.
        Input: Personal details.
        Output: Voter's card, if the person is eligible to vote, otherwise a message that the person is ineligible to vote.

        Process: Examine the age of the person and issue a Voter's ID card if eligible. Otherwise, inform that the person is
        ineligible to vote.

        Pseudocode:
        input: name, gender, date of birth, address, Photograph

        process: a person with an age greater than or equal to 18
                 is eligible to receive a voter's ID
        output: appropriate message according to the person's   eligibility
        Compute age from date of birth

        if age >= 18 then
                 print('Issue a Voter's ID Card')
        else
             print('Not eligible for Voter's ID Card')
        In the above pseudocode, we say: Compute age from date of birth. Here you may ask, is it an effective
        step, i.e., is it executable? The answer is very simple, it is an effective step, if you know how to compute age from the
        date of birth, otherwise, it is not.
        Indentation: You must have noted that the text following the words if, then, and else is shifted slightly to the
        right. This is done to enhance the readability of the pseudocode. So, you must make it a point to write well-indented
        pseudocode.




          94   Touchpad Computer Science-XI
   91   92   93   94   95   96   97   98   99   100   101