computer science: a structured programming approach using c1 4-6 scope scope determines the region...
TRANSCRIPT
![Page 1: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/1.jpg)
Computer Science: A Structured Programming Approach Using C 1
4-6 Scope
Scope determines the region of the program in which a Scope determines the region of the program in which a defined object is visible. Scope pertains to any object defined object is visible. Scope pertains to any object that can be declared, such as a variable orthat can be declared, such as a variable ora function declaration. a function declaration.
Global ScopeLocal Scope
Topics discussed in this section:Topics discussed in this section:
![Page 2: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/2.jpg)
Computer Science: A Structured Programming Approach Using C 2
FIGURE 4-32 Scope for Global and Block Areas
![Page 3: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/3.jpg)
Computer Science: A Structured Programming Approach Using C 3
Variables are in scope from declaration until the end of their block.
NoteNote
![Page 4: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/4.jpg)
Computer Science: A Structured Programming Approach Using C 4
It is poor programming style to reuse identifiers within the same scope.
NoteNote
![Page 5: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/5.jpg)
Computer Science: A Structured Programming Approach Using C 5
4-7 Programming Example— Incremental Development
Top–down development, a concept inherent to Top–down development, a concept inherent to modular programming, allows us to develop programs modular programming, allows us to develop programs incrementally. By writing and debugging each incrementally. By writing and debugging each function separately, we are able to solve the program function separately, we are able to solve the program in smaller steps, making the whole process easier.in smaller steps, making the whole process easier.
First Increment: main and getDataSecond Increment: addFinal Increment: Print ResultsThe
Topics discussed in this section:Topics discussed in this section:
![Page 6: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/6.jpg)
Computer Science: A Structured Programming Approach Using C 6
FIGURE 4-33 Calculator Program Design
![Page 7: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/7.jpg)
Computer Science: A Structured Programming Approach Using C 7
PROGRAM 4-13 Calculator Program—First Increment
![Page 8: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/8.jpg)
Computer Science: A Structured Programming Approach Using C 8
PROGRAM 4-13 Calculator Program—First Increment
![Page 9: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/9.jpg)
Computer Science: A Structured Programming Approach Using C 9
PROGRAM 4-13 Calculator Program—First Increment
![Page 10: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/10.jpg)
Computer Science: A Structured Programming Approach Using C 10
PROGRAM 4-14 Calculator Program—Second Increment
![Page 11: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/11.jpg)
Computer Science: A Structured Programming Approach Using C 11
PROGRAM 4-14 Calculator Program—Second Increment
![Page 12: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/12.jpg)
Computer Science: A Structured Programming Approach Using C 12
PROGRAM 4-14 Calculator Program—Second Increment
![Page 13: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/13.jpg)
Computer Science: A Structured Programming Approach Using C 13
PROGRAM 4-14 Calculator Program—Second Increment
![Page 14: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/14.jpg)
Computer Science: A Structured Programming Approach Using C 14
PROGRAM 4-15 Calculator Program—Final Increment
![Page 15: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/15.jpg)
Computer Science: A Structured Programming Approach Using C 15
PROGRAM 4-15 Calculator Program—Final Increment
![Page 16: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/16.jpg)
Computer Science: A Structured Programming Approach Using C 16
PROGRAM 4-15 Calculator Program—Final Increment
![Page 17: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/17.jpg)
Computer Science: A Structured Programming Approach Using C 17
PROGRAM 4-15 Calculator Program—Final Increment
![Page 18: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/18.jpg)
Computer Science: A Structured Programming Approach Using C 18
4-8 Software Engineering
In this section we discuss three different but related In this section we discuss three different but related aspects of software engineering design: the structure aspects of software engineering design: the structure chart, functional cohesion, and top–down development.chart, functional cohesion, and top–down development.
Structure ChartsStructure Chart RulesFunctional CohesionTop–Down Development
Topics discussed in this section:Topics discussed in this section:
![Page 19: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/19.jpg)
Computer Science: A Structured Programming Approach Using C 19
FIGURE 4-34 Structure Chart Symbols
![Page 20: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/20.jpg)
Computer Science: A Structured Programming Approach Using C 20
FIGURE 4-35 Structure Chart Design
![Page 21: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/21.jpg)
Computer Science: A Structured Programming Approach Using C 21
Structure charts show only function flow; they contain no code.
NoteNote
![Page 22: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/22.jpg)
Computer Science: A Structured Programming Approach Using C 22
FIGURE 4-36 Common Functions in a Structure Chart
![Page 23: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/23.jpg)
Computer Science: A Structured Programming Approach Using C 23
Table 4-1 Structure Chart Rules
![Page 24: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/24.jpg)
Computer Science: A Structured Programming Approach Using C 24
FIGURE 4-37 Calculate Taxes Design
![Page 25: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/25.jpg)
Computer Science: A Structured Programming Approach Using C 25
FIGURE 4-38 Design For Print Report
![Page 26: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/26.jpg)
Computer Science: A Structured Programming Approach Using C 26
PROGRAM 4-16 Top–down Development Example
![Page 27: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/27.jpg)
Computer Science: A Structured Programming Approach Using C 27
PROGRAM 4-16 Top–down Development Example
![Page 28: Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible](https://reader030.vdocument.in/reader030/viewer/2022032805/56649eec5503460f94bfe32b/html5/thumbnails/28.jpg)
Computer Science: A Structured Programming Approach Using C 28
PROGRAM 4-16 Top–down Development Example