Chapter 2: Input, Processing, and Output Flashcards

Program Design and Development Process

  • Overview of Program Development:

    • Software programs must be systematically designed prior to writing code.

    • The Program Development Cycle consists of five primary phases:

    • Design the program

    • Write the code

    • Correct syntax errors

    • Test the program

    • Correct logic errors

  • Software Requirements and Task Analysis:

    • Design is the most critical stage of the software development cycle.

    • Programmers work directly with customers to determine the exact goals and behavior of the program.

    • Detailed software requirements are created by asking specific questions regarding input, processing, and output expectations.

  • Algorithms and Design Representation:

    • Task breakdown: Complex program tasks are broken down into a series of manageable, logical steps.

    • Algorithm definition: A set of well-defined, step-by-step logical instructions required to execute a specific task.

    • Pseudocode:

    • Definition: Fake or informal code that lacks strict syntax rules.

    • Purpose: Functions as an outline or model for a program without compiling or executing.

    • Benefit: Allows developers to focus on logic design without syntax errors before translating directly into actual source code in any programming language.

    • Flowcharts:

    • Definition: A diagram that visually represents the flow of steps in a program.

    • Terminal symbols: Represented by ovals (used for Start and End points).

    • Input/Output symbols: Represented by parallelograms.

    • Processing symbols: Represented by rectangles (used for mathematical calculations or data assignments).

    • Flow lines: Arrows connecting symbols to illustrate execution order.

Pay Calculation Flowchart

Program Input, Processing, and Output Model

  • The Three-Step Execution Cycle:

    • Input: Data received by the program during execution from an external source or user.

    • Processing: Operational transformations performed on the input data, such as arithmetic calculations.

    • Output: The final result produced and presented to the user or saved to a file.

  • Displaying Output with print():

    • Definition of Function: A prewritten sequence of code that performs a specific task.

    • Definition of Argument: Data passed into a function so it can execute its task.

    • Execution Order: Statements execute sequentially from top to bottom in the order written.

    • Basic Syntax: print('Hello world') displays Hello world on the screen.

    • Multi-line Example:

    • Statement 1: print('Programming')

    • Statement 2: print('is')

    • Statement 3: print('fun!')

    • Sequential Output:       Programming       is       fun!

Strings, Literals, and Code Comments

  • Character Strings and Literals:

    • String definition: A sequence of characters stored and processed as data.

    • String literal definition: A hardcoded string value appearing directly within program source code.

    • Enclosure rules:

    • Single quotes: 'sample'

    • Double quotes: `