jagomart
digital resources
picture1_Pcg2015 Ch02handout


 166x       Filetype PDF       File size 0.17 MB       Source: mit.wu.ac.th


File: Pcg2015 Ch02handout
itm 604 program concepts mit 1 2015 chapter 2 itm 604 program concepts school of informatics management of information technology 1 2014 chapter 2 selection control structures lecturer students nichnan ...

icon picture PDF Filetype PDF | Posted on 03 Feb 2023 | 2 years ago
Partial capture of text on file.
                    ITM-604 Program Concepts(MIT 1/2015): Chapter 2
                           ITM-604 Program Concepts
                                 School of Informatics
                       Management of Information Technology, 1/2014
                                      Chapter 2
                        Selection Control Structures
                        Lecturer:                          Students:
                        Nichnan                         MITYear 1
                        Kittiphattanabawon
                                      September 2, 2015
                    N.Kittiphattanabawon                       Page 1 of 9
                                   ITM-604 Program Concepts(MIT 1/2015): Chapter 2
                                   Outline
                                   Contents
                                   The IF Structure                                                                        2
                                       Simple Selection     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     2
                                       Simple Selection with Null False Branch . . . . . . . . . . . . . . . . .            3
                                       Combined Selection       . . . . . . . . . . . . . . . . . . . . . . . . . . . .     4
                                       Nested Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         5
                                   The CASE Structure                                                                      8
                                   N.Kittiphattanabawon                                                         Page 1 of 9
                       ITM-604 Program Concepts(MIT 1/2015): Chapter 2
                       Objectives
                       After completing this lesson, students will be able to:
                         • Elaborate on the uses of simple selection, multiple selection and nested
                           selection in algorithms
                         • Explain the uses of the case structure
                         • Develop algorithms using variations of the selection control structure
                       The IF Structure
                       This structure represents the decision making abilities of the com-
                       puter
                         • The condition in the IF statement is based on a comparison of two items
                             – Usually expressed with on of the following relational operators
                                ∗ <
                                ∗ >
                                ∗ <=
                                ∗ >=
                                ∗ =
                                ∗ <>
                       Four Types of Selection Structures
                         1. Simple selection (simple IF statement)
                         2. Simple selection with null false branch (null ELSE statement)
                         3. Combined selection (combined IF statement)
                         4. Nested selection (nested IF statement)
                       Simple Selection
                       The IF Structure
                       Simple Selection
                       Simple IF Statement
                         • A choice is made between two alternate paths
                             – Depending on the result of a condition being true or false
                       e.g.,
                       IF account balance < 500 THEN
                        service charge = 5.00%
                       ELSE
                        service charge = 2.00%
                       ENDIF
                       N.Kittiphattanabawon                             Page 2 of 9
                       ITM-604 Program Concepts(MIT 1/2015): Chapter 2
                                        Figure 1: Simple IF statement.
                       Simple Selection with Null False Branch
                       The IF Structure
                       Simple Selection with Null False Branch
                       Null ELSE Statement
                         • A task is performed only when a particular condition is true
                         • If the condition is false
                            – Then no processing will take place
                       e.g.,
                       IF student attendance = sick leave THEN
                        add 1 to sick count
                       ENDIF
                                       Figure 2: Null ELSE statement.
                       N.Kittiphattanabawon                            Page 3 of 9
The words contained in this file might help you see if this file matches what you are looking for:

...Itm program concepts mit chapter school of informatics management information technology selection control structures lecturer students nichnan mityear kittiphattanabawon september n page outline contents the if structure simple with null false branch combined nested case objectives after completing this lesson will be able to elaborate on uses multiple and in algorithms explain develop using variations represents decision making abilities com puter condition statement is based a comparison two items usually expressed following relational operators four types else choice made between alternate paths depending result being true or e g account balance then service charge endif figure task performed only when particular no processing take place student attendance sick leave add count...

no reviews yet
Please Login to review.