Page 88 - Computer Genius Class 06
P. 88

Decision:  hould you go to play or not
                  Answer:   es  past       or an hour  i  you ha e completed your home or   i  you ha e not completed
                           your home or  then complete it.
                  Pseudocode:
                       Program Start
                       IF (Homework completed) AND (Time is past 6 PM)
                       THEN

                            Go to play outside for an hour
                       ELSE

                            Complete your homework
                       Program End
                  Possible combinations of the example 1:

                                  Condition 1                          Condition 2                  Decision

                      a e you completed your home or              s the time past             hould you go to play
                                       es                                   es                          es

                                       es                                  No                          No

                                       No                                   es                         No

                                       No                                  No                          No

                  OR Operator
                     operator is used to chec  i  either one o  t o or more conditions is T    or  es.

                   n    operator
                        any o  the condition is true  the operator returns T    or  es.

                        all the conditions are  alse  the operator returns F     or  o.
                  Example 2:  ou should go to play outside  or an hour  i  you ha e completed your home or    or the
                  time is past     .  ther ise  you should not go outside to play.
                  Conditions:  1.   a e you completed your home or
                                2.   s the time past

                  Decision:  hould you go to play outside  or an hour or not
                  Answer:   es  past      you can go to play outside  or an hour  i  you ha e completed your home or
                           i  you ha e not completed your home or  then complete it.

                  Pseudocode:
                       Program Start

                       IF  (You have completed your homework) OR (The time is past 6 PM)
                       THEN
                             Go to play outside for an hour

                       ELSE

                       86    Computer Genius-VI
   83   84   85   86   87   88   89   90   91   92   93