Topic 3 - Problem Solving Organization
Topic 3 - Problem Solving Organization
PROGRAM LOGIC
FORMULATION
Topic 3: Problem Solving Organization
[email protected]
2020
Learning Outcomes
• List and describe the basic tools used to aid in the development of a solution to a
problem:
• Problem Analysis Chart (PAC)
• Structure Chart or Interactivity Chart
• IPO Chart
• Algorithms
• Flowcharts
• Data Dictionary
• Describe the categories of documentation
Communicating with the Computer
• A computer needs instructions governed by specific rules.
• If instructions are incorrect, it can result in errors, the wrong answer or no
answer at all.
• Terms:
• Syntax – Rules that govern the computer operating system, language and application.
Bug – Errors that can come from syntax or logic errors.
• Debugging – Act of finding and correcting bugs
• Goal: Solve problem with the most efficient solution.
Organizing the Solution
• Organizational tools can help to solve problems
on the computer.
• Steps:
• Analyze the problem – PAC
• Divide problem into subtasks/modules – Interactivity chart
• Identify inputs, processes and outputs – IPO chart
• Develop the algorithm
• Draw the flowchart
Analyzing the Problem (PAC)
• The problem analysis chart (PAC) divides a problem into four parts:
Indicates
module
reuse.
Indicates a decision:
Either Module 6 or Module 7
1100
will be executed. Not both.
Develop Structure Chart (cont.)
• Example:
• Calculate the gross pay of an employee given the hours worked and the rate of the pay.
The gross pay is calculated by multiplying the hours worked by the rate of the pay. Print
the gross pay for each employee.
Control
0000
Until NoMoreEmployees
Read module The Print module
prints the
is required to Read Calc Print
processed
enter data in the 1000 2000 3000
solution. information
The Calc module (gross pay)
processes the
data for each
employee.
Develop Structure Chart (cont.)
• Your turn:
• Calculate the average marks for a student based on five exams: English, Maths, History,
IT and Science. The student can then choose whether to display the output as the
average marks or the grade (A,B,C).
Control
0000
Until NoMoreStudents
AverageMarks Grade
3100 3200
Develop IPO Chart
• The input-processing-output (IPO) chart extends information from the PAC and
interactivity/structure chart.
Enter Hours
Enter PayRate
Display GrossPay
End
Data Dictionary
• A data dictionary can be used to keep track of variables in a program.
• It is a list of:
• Items
• Variable name
• Data type
• Module – Where to find the variable
• Scope
• Pseudonym/Model – Alternate name of a variable in a different module
• Error checks
Data Dictionary
Item Variable Name Data Type Module Scope Pseudonym/ Error Check
Module
Hours worked Hours Numeric-real Control Local Hrs None
Hours worked Hrs Numeric-real Read/Calc Parameter Hours Hours<0
Pay rate PayRate Numeric-real Control Local Rate None
Pay rate Rate Numeric-real Read/Calc Parameter PayRate PayRate<4.00
Gross pay Pay Numeric-real Control Local None None
Gross Pay Pay Numeric-real Calc/Print Parameter None None
Documentation
• Internal Documentation
• Comments or remarks written with the instructions to explain what is being done in the
program.
• For the programmers.
• External Documentation
• Manuals or help menus written about the solution.
• For the users.
Review Learning outcomes
• List and describe the basic tools used to aid in the development of a solution to a
problem:
• Problem Analysis Chart (PAC)
• Structure Chart or Interactivity Chart
• IPO Chart
• Algorithms
• Flowcharts
• Data Dictionary
• Describe the categories of documentation
Questions?
End of topic 3