Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

1

Organizing Computer Solution


(Problem Analysis Chart)
Lecture 4
-

20th Feb, 2024

ICT172: Principles to Programming


Lecture Notes
Quick Quiz 1 on Last Lecture
•Evaluate the following given that a is 10 and b is
5

(0>=-5)AND(5!=5)OR(a<b*2)

ICT172: Principles to Programming


Lecture Notes 2
Quick Quiz 2 on Last Lecture
•The interest on a loan is calculated as 10% of the
principal. Represent this as a formula in
computer form.

ICT172: Principles to Programming


Lecture Notes 3
Lesson Objectives
By the end of the lesson, students will be able to:

1. Analyze problems using Problem Analysis Chart


(PAC)
2. Use an IPO chart to designate the input, processing,
and output for a solution of a problem.
3. Convert and write an IPO into a Pseudocode
4. Draw flowchart solution to problems

ICT172: Principles to Programming


Lecture Notes 4
Problem Solving Tools
•Certain organizational tools will help you to solve
problems on the computer. The tools commonly used
include:
•Problem Analysis Charts (PAC) - shows an initial break
down of a problem into its manageable components.
•IPO Chart - shows the input, the processing, and the
output for a solution.
•Algorithm - show the sequence of steps comprising
the solution
•Flowchart - show a graphic representations of the
algorithms
•Pseudocode - show an English like sequence of
steps comprising a solution.
ICT172: Principles to Programming
Lecture Notes 5
Developing an Problem Analysis Chart
• The problem analysis chart (PAC) is a problem solving tool used
to analyze and understand the requirements of a problem.
• The PAC is made up of four sections.
Given data (Input) Required Results (Output)
Section 1: Data given in the problem or
Section 2: Requirements for the output reports.
to be provided by the user. These can be
This includes the information needed and
known values or general names for data,
the format required.
such as price, quantity, and so forth.
Processing required Solution Alternatives
Section 3: List of processing required. This
includes equations or other types Section 4: List of ideas/alternatives for the
of processing, such as sorting, solution of the problem.
searching, and so forth.

ICT172: Principles to Programming


Lecture Notes 6
Example
•You are required to develop a plan to calculate the
gross pay of an employee given the hours worked and
the rate per hour. The gross pay is calculated by
multiplying the hours worked by the rate of pay.

•Draw a Problem Analysis Chart for the problem.

ICT172: Principles to Programming


Lecture Notes 7
Solution

Given data Required Results


hoursWorked
grossPay
payRate
Processing required Solution alternatives
1.Define the hours worked and
g𝑟𝑜𝑠𝑠𝑃𝑎𝑦 = ℎ𝑜𝑢𝑟𝐬𝑊𝑜𝑟𝑘𝑒𝑑 ∗ pay rate as constants.
𝑝𝑎𝑦𝑅𝑎𝑡𝑒 2. *Define the hours worked and
pay rate as input values.

ICT172: Principles to Programming


Lecture Notes 8
Assignment

•Write a Problem Analysis Chart (PAC) to find an


area of a rectangle where area = length * width.

Given data Required Results

Processing required Solution alternatives

ICT172: Principles to Programming


Lecture Notes 9
Assignment
•Write a PAC for solving a Quadratic equation given
as: 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0.

Given data Required Results

Processing required Solution alternatives

ICT172: Principles to Programming


Lecture Notes 10
Assignment
•Three project assignment will be written for this
course each of which is marked over 10. The
course lecturer is interested in computing and
recording the average of the three project scores.
Develop
Given dataa PAC to the problem above.
Required Results

Processing required Solution alternatives

ICT172: Principles to Programming


Lecture Notes 11
Assignment

•Write a Problem Analysis Chart (PAC) to find an area of


1
a triangle where area = * height * length. Then create
2
IPO
Given data Required Results

Processing required Solution alternatives

ICT172: Principles to Programming


Lecture Notes 12
Let us try!
•Write a Problem Analysis Chart (PAC) to convert the
distance in miles to kilometers where 1.609 kilometers
per mile. Then create IC and IPO
Given data Required Results

Processing required Solution alternatives

ICT172: Principles to Programming


Lecture Notes 13
Let us try, again!
Write a Problem Analysis Chart (PAC) to compute
and display the temperature inside the earth in
Celsius and Fahrenheit. The relevant formulas are:

Celsius = 10 * (depth) + 20
Fahrenheit = 1.8*(Celsius) + 32

ICT172: Principles to Programming


Lecture Notes 14
15

Organizing Computer Solution


(IPO)
Lecture 5
-

20th Feb, 2024

ICT172: Principles to Programming


Lecture Notes
Input Processing Output (IPO) Chart
•The IPO (input-processing-output) chart, also called a
defining diagram, extends and organizes the information
in the problem analysis chart.
▪It shows in more detail what data items are input
▪It shows also what processing takes place on that
data
▪It shows what information will be the end result, the
output.

• The output is the first to be completed in an IPO chart. The


next is the input. The last is the processing.
ICT172: Principles to Programming
Lecture Notes 16
IPO Chart
•The IPO chart emphasizes 3 of the main components
of a problem;
1. Input
2. Processing
3. Output
Input Processing Output
All input data (from All processing steps All output
Section 1 of the (from Sections 3 and 4 requirements
Problem Analysis of the problem (from Sections 1 and 2
Chart) analysis chart) of the problem
analysis chart)
ICT172: Principles to Programming
Lecture Notes 17
Tips on developing IPO charts
• You can identify the inputs as the data that is either given or
read by the program
• Outputs are usually the expected result(s) after processing.
• In a problem definition, inputs and outputs are expressed as
nouns or adjectives.
• The actions needed for processing are usually specified in the
problem statement as verbs.
•When solving a problem:
▪Underline all the nouns and adjectives in the problem
statement.
▪Look at the underlined nouns and decide which are inputs and
which are outputs.
▪Draw the IPO chart and put the information together in the
appropriate columns.
ICT172: Principles to Programming
Lecture Notes 18
Example
•A program is required to read three numbers, add
them together and print their total.

•Design an IPO chart to depict the problem.

ICT172: Principles to Programming


Lecture Notes 19
Suggested Solution
STEPS
• First, underline the nouns in the problem statement. This gives us:

• A program is required to read three numbers, add them


together and print their total.

• Second, underline (in a different colour) the verbs and adverbs


used in the problem. This will establish the actions required. This
gives us:

• A program is required to read three numbers, add them


together and print their total

• Lastly, draw the structure of the IPO and put the information
together:
ICT172: Principles to Programming
Lecture Notes 20
The Suggested IPO chart

INPUT PROCESSING OUTPUT


First number 1. Read firstNumber total
Second number 2. Read secondNumber
Third number 3. Read thirdNumber
4. Add the three numbers
together to find total
5. Print total

ICT172: Principles to Programming


Lecture Notes 21
Another Solution

INPUT PROCESSING OUTPUT


First number 1. Read three numbers total
Second number 2. Add the three numbers
Third number together
3. Print total

ICT172: Principles to Programming


Lecture Notes 22
In-class Exercise
•A program reads the maximum and a minimum
temperature reading on a particular day;
afterwards it calculates and displays on the
screen the simple average temperature
calculated as;

(maximum temperature + minimum temperature) / 2

ICT172: Principles to Programming


Lecture Notes 23
In-class Exercise
•A student's final score for a course is a weighted sum
of two tests, a mid semester exam, and a final exam.
Each test is worth 10%, the mid semester exam is worth
20%, and the final exam is worth a total of 60%. Given
a student's score for all of these assignments, calculate
the final score and grade of the student based on the
grading system below.

•Use an IPO to analyse the problem above.

ICT172: Principles to Programming


Lecture Notes 24
???

ICT172: Principles to Programming


Lecture Notes 25
End of Lecture 5

ICT172: Principles to Programming


Lecture Notes 26

You might also like