You are on page 1of 37

Chapter 3

ICOS111B

Open Rubric
ICOS111B
Planning your
solution

ICOS111B
Planning your solution
To analyze a problem and set up the most
efficient solution, a programmer organizes the
solution by using all or some of these tools.
When the programmer does not use these tools
during the problem-solving process, the solution
takes longer to program, and the final program
is less efficient, lacks readability, and increases
programmer frustration.

ICOS111B
Organizational tools that help solve
problems on the computer

• Problem analysis chart • Coupling diagram


• Structure chart • Data dictionary
• Interactivity chart • Uml
• IPO chart
• Algorithms
• Flowchart
• Pseudo code
ICOS111B
• Problem analysis chart
• Structure chart
• Interactivity chart

ICOS111B
Scenario

Calculate the gross pay of an employee


given the hours worked and the rate of pay.
The gross pay is calculated by multiplying
the hours worked by the rate of pay.

ICOS111B
Problem analysis chart - PAC
Problem analysis chart, shows a beginning
analysis of the problem

ICOS111B
Problem analysis chart - PAC
The PAC allows the problem solver to eliminate
the words and glean only the facts from the
problem.
Data, constants and variables, would be entered
in the Given Data section. Variable data are the
input values.
Requirements for the output reports would be
entered under Required Results.

ICOS111B
Problem analysis chart - PAC
Any equations or other processing requirements
would be listed in the Processing Required
section.
Finally, the programmer would write any other
ideas that spring to mind concerning the
solution in the Solution Alternatives section.

ICOS111B
Scenario - Problem analysis chart

ICOS111B
The structure chart or interactivity
chart
The structure chart or interactivity chart shows
the overall layout or structure of the solution
This is done by dividing the processing into
subtasks called modules and then to connect these
modules together to show the interaction of
processing between the modules. Each module
should contain the tasks to accomplish one
function, such as entering data, printing results, or
calculating results.
ICOS111B
The structure chart or interactivity
chart

The darkened circles indicate that the module is part of a set of modules that are
processed many time
ICOS111B
The structure chart or interactivity
chart
There will be one module that controls the flow
to most of the other modules. This will be called
the Control or Main module. Each module should
contain no more than 20 instructions. This
breakdown enables you to view a complex
problem in simpler parts and to program smaller,
simpler parts of a program rather than one large,
complex program.

ICOS111B
The structure chart or interactivity
chart
Dividing a solution into modules is not an easy
job. When you approach a solution to a
problem, you need to think about the basic
things you want to accomplish, during the
processing, in general terms. Some of these
might be input of data, initialization of data,
types of processing such as calculations or
putting data in order, and completing the
solution.
ICOS111B
The structure chart or interactivity
chart

ICOS111B
The structure chart or interactivity
chart
• Two modules (Salaried and Hourly) to enter
data needed for two different types of
employees.
• The control module (Control) to control the
processing of the solution.
• An initialize module (Initialize) to process data
that needs to be accomplished only once in
the solution and at the beginning.
• A read module (Read) to enter data needed in
the solution. ICOS111B
The structure chart or interactivity
chart
• A calculation module (Calculate) to process
the data for each employee.
• A print module (Print) to print the processed
information.
• A wrap-up module (WrapUp) to process any
data that should be done only once in the
solution and at the end of the solution.

ICOS111B
Scenario - Structure chart or Interactivity
chart

The darkened circles indicate that the module is part of a set of modules that are
processed many times

ICOS111B
The IPO chart
The IPO chart shows the input, the processing,
and the output

The IPO (input-processing-output) chart extends


and organizes the information in the problem
analysis chart. It shows in more detail what data
items are input, what processing takes
place on that data, and what information will be
the end result, the output

ICOS111B
The IPO chart

The IPO chart has four sections: the Input, the


Processing, the Module Reference, and the
Output.

ICOS111B
The IPO chart

• The Input section contains all input data from


the problem analysis chart. The input includes
all given data from Section 1 on the problem
analysis chart.
• The Processing section contains all processing,
evident and implied, from Sections 3 and 4 of
the problem analysis chart.

ICOS111B
The IPO chart

• The Module Reference section contains the


number from the interactivity chart of the
module in which each step in the processing is
to be completed.
• The Output section includes all required
output as designated by the problem and/or
the user; it comes from Section 2, along with
the needed input items from Section 1, of the
problem analysis chart.
ICOS111B
The IPO chart

ICOS111B
Scenario – IPO Chart

ICOS111B
Algorithms
Flowchart
Pseudo code

ICOS111B
The Algorithm
To complete all of the algorithms needed to solve a
problem, the programmer writes a separate set of
instructions for each module in the structure chart.

ICOS111B
The algorithm
Setting up the algorithms is probably the
hardest part of problem solving on the
computer. The instructions cannot assume
anything, cannot skip steps, must be executable
one step at a time, and must be complete. The
modules are taken from the interactivity chart,
and the processing is taken from the IPO chart.

ICOS111B
The algorithm
The number of instructions in an algorithm is
determined by the way the programmer
chooses to solve the problem. The algorithms
pull the interactivity chart and the IPO chart
together to give a logical step-by-step solution.

ICOS111B
The flowcharts
The flowcharts are graphic representations of the
algorithms

ICOS111B
The flowcharts

ICOS111B
The flowcharts

ICOS111B
The pseudo code
Pseudo code, represents a language like solution

ICOS111B
Scenario – Algorithm, Flow charts &
pseudo code

ICOS111B
Scenario – Algorithm, Flow charts &
pseudo code

ICOS111B
Scenario – Algorithm, Flow charts &
pseudo code

ICOS111B
Scenario – Algorithm, Flow charts &
pseudo code

ICOS111B
ICOS111B

You might also like