Chapter 2 Problem Solving Outline and Objective - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Chapter 2 Problem Solving Outline and Objective

Description:

Consists of combination of 0's and 1's that represent high and low electrical voltage. ... Most common flowchart symbols are: Terminal. Flowline. Input/Output ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 14
Provided by: fay85
Category:

less

Transcript and Presenter's Notes

Title: Chapter 2 Problem Solving Outline and Objective


1
Chapter 2 Problem SolvingOutline and Objective
  • Programming Language
  • Machine Language
  • Assembly Language
  • High level Language
  • Program Development Cycle
  • Analyze Design Interface
  • Code Debug and Test ... Documentation
  • Programming Tools
  • Flowchart
  • Pseudocode
  • Hierarchy Chart (Structure chart)

2
Machine Language
  • A first generation language.
  • The fundamental language of the computers
    processor, also called Low Level Language.
  • All programs are converted into machine language
    before they can be executed.
  • Consists of combination of 0s and 1s that
    represent high and low electrical voltage.

3
Assembly Language
  • A second generation language.
  • A low level language that is similar to machine
    language.
  • Uses symbolic operation code to represent the
    machine operation code, e.g., A for add, MVC for
    move, etc.
  • Must be translated in machine code.
  • Usually used to write system software programs
    such as operating systems and utility programs.

4
High Level Language
  • A third generation language.
  • Computer (programming) languages that are easier
    to learn.
  • Uses English like statements, e.g., PRINT SALES,
    READ HOURS, etc.
  • Examples are C , Visual Basic, Pascal, Fortran
    and ....

5
2.1 Program Development Cycle
  • 1. Analyze Define the problem.
  • 2. Design Plan the solution to the problem.
  • 3. Choose the Interface Select the objects
  • 4. Code Translate the algorithm into a
    programming language.
  • 5. Debug and Test Locate and remove any errors
    in the program.
  • 6. Complete the Documentation Organize all the
    materials that describe the program.

6
2.2 Programming Tools
  • Flowchart
  • Pseudocode
  • Hierarchy Chart (Structure chart)

7
What is a flowchart?
  • Logic diagram to describe each step that the
    program must perform to arrive at the solution.
  • A popular logic tool used for showing an
    algorithm in graphics form.
  • Programmer prepares flowchart before coding.
  • Most common flowchart symbols are

Processing
Terminal
Flowline
Input/Output
Decision
8
Purpose of Flowcharting
  • An aid in developing the logic of a program.
  • Verification that all possible conditions have
    been considered in a program.
  • Provides means of communication with others about
    the program.
  • A guide in coding the program.
  • Documentation for the program.

9
Class Average Algorithm Problem
  • Problem Calculate and report the grade-point
    average for a class.
  • Discussion The average grade equals the sum of
    all grades divided by the number of students. We
    need a loop to read and then add (accumulate) the
    grades for each student in the class. Inside the
    loop, we also need to total (count) the number of
    students in the class.

10
Flowchart for the Class Ave. Problem
Start
See Figure 2.8 for the complete flow chart
Initialize Counter 1 and sum to 0
Are there more data
No
Yes
Get next grade
Increment counter
Add grade to sum
11
Desk Checking
  • The process of testing the flowchart with
    different data as input, and checking the output.
  • The test data should include nonstandard data as
    well as typical data.

12
What is a Pseudocode?
  • A program design technique that uses English
    words.
  • Has no formal syntactical rules.
  • Example To determine the average grade of a
    class
  • Do while there are more data
  • Get the next Grade
  • Add the Grade to the Sum
  • Increment the Counter
  • Loop
  • Compute average Sum / Counter
  • Display average

See Figure 2.9
13
What is a Hierarchy Chart?
  • Shows the overall programs structure.
  • Describes what each part, or module, of the
    program does.
  • Also how each module relates to other modules in
    the program.
  • The following is the hierarchy chart for the
    class average problem

Class average Program
See Figure 2.10
Get Grade
Calculate Average
Compute Sum
Display Average
Write a Comment
User Comments (0)
About PowerShow.com