01969_PPT_ch02_COMP230

01969_PPT_ch02_COMP230 - Programming Logic and Design Fifth...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Logic and Design Fifth Edition, Comprehensive Chapter 2 Understanding Structure
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 2 Objectives Learn about the features of unstructured spaghetti code Understand the three basic structures: sequence, selection, and loop Use a priming read Appreciate the need for structure Recognize structure Learn about three special structures: case , do- while , and do-until
Background image of page 2
Programming Logic and Design, Fifth Edition, Comprehensive 3 Understanding Unstructured Spaghetti Code Spaghetti code : logically snarled program statements Can be the result of poor program design Spaghetti code programs often work, but are difficult to read and maintain Convoluted logic usually requires more code
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 4 Understanding Unstructured Spaghetti Code (continued) Example: College Admissions Admit students who score >= 90 on admissions test if upper 75 percent of high-school graduating class Admit students who score >= 80 on test if upper 50 percent of high-school graduating class Admit students who score >= 70 on admission test if upper 25 percent of high-school graduating class
Background image of page 4
Programming Logic and Design, Fifth Edition, Comprehensive 5 Understanding Unstructured Spaghetti Code (continued) Figure 2-2 Spaghetti code example
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 6 Understanding the Three Basic Structures Structure : basic unit of programming logic Any program can be constructed from only three basic types of structures Sequence Perform actions in order No branching or skipping any task Selection (decision) Ask a question, take one of two actions Dual-alternative or single-alternative Loop Repeat actions based on answer to a question
Background image of page 6
Programming Logic and Design, Fifth Edition, Comprehensive 7 Understanding the Three Basic Structures (continued) Sequence structure Figure 2-3 Sequence structure
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 8 Understanding the Three Basic Structures (continued) Selection structure Figure 2-4 Selection structure
Background image of page 8
Programming Logic and Design, Fifth Edition, Comprehensive 9 Understanding the Three Basic Structures (continued) Dual-alternative if : contains two alternatives if someCondition is true then do oneProcess else do theOtherProcess
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Programming Logic and Design, Fifth Edition, Comprehensive 10 Understanding the Three Basic Structures (continued) Single-alternative if : contains one alternative Figure 2-5 Single-alternative selection structure
Background image of page 10
Programming Logic and Design, Fifth Edition, Comprehensive 11 Understanding the Three Basic Structures (continued) Single-alternative if Else clause is not required Null case : situation where nothing is done if employee belongs to dentalPlan then deduct $40 from employeeGrossPay
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/18/2011 for the course COMP 230 taught by Professor Deokar during the Summer '11 term at DeVry Cincinnati.

Page1 / 50

01969_PPT_ch02_COMP230 - Programming Logic and Design Fifth...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online