We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
PROBLEM ANALYSIS AND DESIGN TOOLS
Until now the theory of problem-solving (Newell and
Simon, 1972) has mainly emphasized the search of solutions
within a problem'space. From this viewpoint, problem-solving
capability (intelligence) should be seen as the possession of
adequate logic, which allows making the search more efficient.
The first thing to be done in order to solve an ill-
structured problem is to formulate it in a well-structured way.
Once we know how to construct (and transform)
representations of ill-structured problem domains, we can
simply apply the existing knowledge about search through
problem spaces to be able to solve all types of problems.
Definition of Terms
Abstract A well-structured problem formulation in order to
tackle a complex problem domain. General
representations constructed to analyze, hierarchically
organized, as well: as a systems of distinctions,
securing the survival of an agent with respect to his
situation. Abstract is preliminary variation-selection
model outlined combining theoretical, computational
and empirical-psychological approaches for solving a
problem domain.
Abstraction is a design activity that makes use of models first
before implementation. This is a process of building
simple structures out of the available data, which are
often inconsistent, ambiguous, unclear and changeful
in manner. This is also the act of separating the
inherent qualities or properties of something from
the actual physical object or concept to which It
belongs.Chapuer? Programming Language,»
Iil-structured problem can be characterized, first, by th
presence of a “problem” or a situation which is to be
changed in some way. The absence of the structure
needed for efficient search, constraints in walle
defined goal(s), problem-states, operators, heuristic
criteria, .
IPO Chart Known as Input-Process-Output Chart. IPO links the
Input and Output and specifies what input data go
Into a process and what output Is generated as an
outcome.
Narrative Program logic Is described and communicated
through words. Procedures and instructions are
narrated which may be numbered to Indicate
sequence or order.
Algorithm is a mathematical narrative or logical step-by-step
procedure of solution in solving a particular problem,
Flowchart Is a diagram that uses standard ANSI (American
National Standards Institute) symbols to show the
step-by-step processing activities and decision logic
|
> ee
(Chapter 2 1
PROBLEM ANALYSIS
The Program Plan
int provides 2
the bluep!
The program Pian te ing problems. It
systematic approach to computer programm!
consists of several important sub-steps.
‘The first step Is to define the problem. In this step the
problem is examined carefully to determine what questions
poet be answered before attempting to solve the problem.
from this sub-step the required output of the program Is
determined.
‘The next step Is to assemble all given data and to assign
variable names to those quantities, which are unknown. All
Unnecessary Information should be discarded because many
problems contain Information which has no meaning to the
Solution. From this sub-step, the available data are derived.
‘The next step Is to discover relationships among data
and to express the relationship as equation. The equations are
needed in solving problems. Siso arranged In order of Importance so that the proper
Sequence of the solution may be determined. From this sub-
step, the processing requirements are determined
Example of an IPO chart: Example of a Program Plat
Create a program plan that will compute for an
‘employee’s weekly net pay and will generate the employee's
pay slip similar to the one below: f
ys
Payroll Period J
June 10- 25, 2013 7
INPUT PROCESS
ouTPUT
FIRST
NUMBER
TO GET THE
SUM - ADD
FIRST NUMBER
TO SECOND
FIRST
NUMBER
Employee Name: Juan Dela Cruz
SECOND SECOND
NUMBER NUMBER NUMBER Regular Hours worked: 56 hrs.
i Regular rate: P 50.00
PRINT THE SUM suM { Basic Salary for the Week: P 2,800.00
Overtime Hours rendered: 15 hrs.
| Overtime Pay: P 1,125.00
Fig 1.0 Input-Process-Output (IPO) P 3,925.00
Figure 1.0 demonstrates an example where two (2) P 588.75
numbers are accepted and added together as thelr Sum. 3,336.25
10 tyChapter 2 Programming Language } 4
employee name, regular hours
worked, and overtime hours rendered are to be entered from
the keyboard. Overtime pay is one and one-half times the
regular rate while tax is set at 15 % of the gross.
The payroll period,
‘Solution:
Program Plan:
a. Required Output:
Payroll Period
MM-DD-YYYY
Employee Name: KKK KHHHHKKK
Regular Hours worked 99
Regular rate _P 99.99
Basic Salary for the Week P 9,999.99
Overtime Hours rendered 99
Overtime Pay P 9,999.99
Gross Pay: P9,999.99
Less: Tax P.9,999.99
Net Pay: P. 9,999.99
b. Available Input
Payroll Period = PPeriod
Employee Name = EName
Regular Hours Worked = RHWorked
Regular Rate = RRate
Overtime Hours Rendered = OHRendered
yaene
c. Processing Requirements
1. Net Pay = Gross pay - Tax
2. Gross pay = Basic Salary of the Week +
Overtime Pay
3. Tax = Gross Pay *.15
4. Basic Salary = RHWorked * RRate
5. Overtime Pay = OHRendered * RRate * 1.50
12Chapter 2 : Programming Language 1
Algorithm
This refers to the narrative step-by-step solution to the
problem. Using ordinary English language, the solution or the
steps how to transform the problem's input Into an output Is
discussed.
In planning the algorithm, an IPO chart can be used. An \
pe cart is divided into three columns: Input, Process and
jutput.
Most algorithms begin with an instruction that enters the
Input data Into the computer. The input data are listed in the
Input column of an IPO chart.
After the instructions to enter the Input items, the next
set of instructions process the input typically by performing
some calculations on some processing items. Processing items
represent an intermediate value that the algorithm uses when
processing the Input into the output. These steps are entered
In the Processing column of an IPO chart.
Algorithms usually end with an instruction either to print
or display or store the output items which are listed In the
Output column of the of the IPO chart.
Example Algorithm:
Problem: Compute the area (A) of the circle with the given
radius (r) and a constant value of pi =3.14159 (p).
Algorithm:
1. Input the radius. Lao hed vuln (n)
2. Compute the area using the formulaA =pxr. = ung .
3. Print the area (A). ~ aces Se CL ry om.
Now, using the above given example that would create a per
program plan to compute the area and perimeter of a rectangle.
Based on the specifications given, let us create the IPO chart. |
14(Chapter 2 Programming Language | Al \
Solution:
‘Input Processing Output
Formulas: 1
Length (L) LxW Area (A), |
‘width (W) 2(L+W) Perimeter (P) t
where:
‘area |
Perimeter
Algorithm:
1. Compute the Area by
multiplying the Length and
width of the rectangle;
2. Add the value of Length to
the Width of the
rectangle;
3. Then multiple It by two(2)
‘ to obtain it’s Perimeter
‘The following are helpful hints a programmer may consider
in planning an algorithm.
4. Before writing an algorithm, consider whether you have
already solved a similar problem. If you have, you can
use the same solytion, often with little modification to
solve the current problem.
2. If you have not solved similar problem, consider
whether you can use a portion of an existing algorithm
‘to solve. the current problem, -
7 you have not solved a similar problem, ahd If you cannot use
a portion ‘of an existing problem, solve the problem manually,
‘noting each step you take to do so.
Example No. 2 for Algorithm
Instructions: Create a program plan and an algorithm for the
following cases.
1. A man knows that the gasoline tank of his car holds 24
gallons and that his car averages 18.3 miles per gallon. He
starts with a full tank and drives at 45 miles per hour. Find
the volume of the gasoline left in the tank at any given time
a
The volume of the gasoline left In the tank
Required
Output
‘Available Full Tank = Volume = 24 gallons
input ‘Average miles per gallon = 18.3 miles/gallons
(amg)
sroCessIn: Fwerage gasoline consumption = amg * time
Procsirements Volume Consumed = Speed/Average Gasoline
Consumption at any given time
Volume Remaining = Full Tank - Volume
Consumed
‘Algorithm
‘Start
Enter time (t) \
To obtain the average gasoline consumption at any given
time, multiply amg by (t), call It as (Avat)
To obtain the volume consumed, divide the car’s speed by
Avgt, name It as (V2)
To compute the remaining gasoline subtract (V2) from (V1),
gos ype
all It as (VRemaining)
6.__ Stop
FLOWCHART AND FLOWCHARTING SYMBOLS
Flowchart Is also known as “Process Flow Charts” which
was introduced in 1921 by Frank Gilbert, and it was used by
‘Allan H. Mogensen to train business people. With the proper
use of flowchart you can represent the solution to the simple to
complex problems.
Types of FLOWCHART:
1. Program flowchart A plan of attack showing the
detailed steps required In the solution to a given
problem. It Is a graphical representation of the
operations required carrying out a data processing.
Flowchart Is also defined as pictorial representation
of the structure and sequence of operations Involved
in the solution to a problem.
2. System flowchart Is a System Development
modeling tool, used to diagram and document design
of a new system and present an overview of the
entire system, Including data flow (point of Input,
output and storage) and processing activities. This
flowchart Is used to show in general terms what Is to
be accomplished by the program. .
16noes Programming Language 1‘ * \-
FLOWCHARTING SYMBOLS
Before drawing the flowchart one must understand the
different symbols used In flowcharting. There are many symbols
used In flowcharting, for uniformity and best practices, It should
be agreed upon that the following symbols be used:
FUNCTION
TERMINATOR/TERMINAL. Used to
Indicate the beginning and ending of a
flowchart or routine. .
PREPARATION/INITIALIZATION. Used
to initialize work areas such as counters,
accumulators, or array.
OFF PAGE CONNECTOR is used to
connect separate pages of a flowchart
ON-PAGE CONNECTOR Is used to
Indicate the point of which transfer of
yy
Programming Language
SYSTEM FLOWCHART SYMBOLS
FUNCTION
OR
PREDEFINED PROCESS
SUBROUTINE denotes a sequence
of steps which are separate from
the main flowchart
REPORT/ DOCUMENT Is used to
print results, reports, or messages.
MANUAL INPUT (KEYBOARD) is
used to enter data manually.
DISPLAY shows results on the
screen, CRT (Cathode Ray Tube)
STORED DATA or saved data
SEQUENTIAL ACCESS STORAGE
read data In sequence.
control.
DIRECT DATA data can be inputted
DECISION Is used to test a condition, mannually
which will be either TRUE or FALSE.
SYMBOL
INPUT/OUTPUT Is used to indicate
where data are entered and also where
results are written. This symbol is used
when 1/0 device name Is not given. ‘
2 INTERNAL STORAGE Is used for
storing/saving data.
T FLOW LINES Is used to Indicate the
559 sequence in which instruction is executed.
i MERGE symbol used for combining
set of data or separating data.
ANNOTATION | indicates remarks or
comments.
0 AROAOLUWE
~ DAA eASE
TE
fre
Souk
17 182 Programming Language} '°
rogram flowchart
yt
<>
a) Example ofap
ES