100% found this document useful (2 votes)
665 views30 pages

PSPD Bab2 (IPO) PDF

This document discusses problem solving methods and how they relate to programming and computers. It defines a problem, problem solving, and the key steps involved which include identifying inputs, outputs, and what needs to be computed. It explains that programming is a problem-solving skill that involves understanding how humans solve problems and translating that into a computer's language and syntax. The document also provides examples of analyzing a real-world problem by identifying the inputs, processes, and outputs using an ATM transaction scenario. Overall, the document covers problem solving fundamentals and how they apply to programming and analyzing problems systematically.

Uploaded by

laurynna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
665 views30 pages

PSPD Bab2 (IPO) PDF

This document discusses problem solving methods and how they relate to programming and computers. It defines a problem, problem solving, and the key steps involved which include identifying inputs, outputs, and what needs to be computed. It explains that programming is a problem-solving skill that involves understanding how humans solve problems and translating that into a computer's language and syntax. The document also provides examples of analyzing a real-world problem by identifying the inputs, processes, and outputs using an ATM transaction scenario. Overall, the document covers problem solving fundamentals and how they apply to programming and analyzing problems systematically.

Uploaded by

laurynna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

DFC10042

PROBLEM SOLVING &


PROGRAM DESIGN

Astri Idayu Binti Athesan


TOPIC 2

PROBLEM SOLVING METHODS

(part 3)
What is What is
problem? problem
solving?
any thing, matter,
person, etc., that is the process of
is difficult to deal transforming the
description of a
with, solve, or
problem into the
overcome.
solution

Problem Solving Concept


How to solve the problem?

By using our knowledge of By relying on our ability to Problem solving may include
the problem select and use appropriate mathematical or systematic
problem-solving techniques operations and involve critical
and tools thinking and logic skills.

Problem Solving Concept


What is problem solving?
< In Programming >
Learning aboutProgramming
"for" loops is not
is alearning
way ofto program,not
thinking, anyamore
wrotethan learning about
skill.
pencils is learning to draw.

People
If a programmer cannot understand
see whatisthey
what a program can
doing, shesee.
can't understand it.

Programmers must first understand


how a human solves a problem, Can we say that
then understand how to translate Programming is a problem-solving
this "algorithm" into something a
skill ?
computer can do, and finally how to
"write" the specific syntax (required
by a computer) to get the job done. It is one of the method approach
towards building a good program.

Problem Solving Concept


How does Problem Solving relate to
your computer ?
Fundamentals of a computer

A computer has four functions

1 2 3 4
Fundamentals
Topic 2 : Problem of a computer
Solving Methods

In a much simpler explanation

Before it can be process (or


know what to do next) Computer To produce an
output

Input Process Output

It needed an
input
Store it in memory(in
case it needed it)
Storage
STEPS involve in Problem Solving

1 2 3 4
Identify the Identify other Identify what Write an
inputs and data and needs to be algorithm.
outputs constants computed.
required to
solve the
problem.
This sub-topic focuses on
PLC : Phase 2
< Analyzing the problem >
Phases in programming life cycle

Phases
1 2 3 4 5 6 7

Test & verify the

Documentation
Implement the
Analyze the

Update the
Maintain &
Specify the

Design the
algorithm

algorithm

program

program
problem

problem

A step in Identified Developed a Use a checked the Monitors Report/ user


which you problem series of steps medium to output to system manual of the
have inputs, with a logical solve the verify the performance project
eliminated problem order which, problem or to correctness of , rectifies development
ambiguities in output and when applied, produce an your method bugs and
the problem collected would produce output of solution. requested
statement information the output of changes are
about the the problem. made
inputs.
Purpose of How?

problem Understand the problem and try to


identify

analysis >> Input


• Refers to the process of
entering data, program and
instructions into the computer
system using input devices.
To explain the details of >> Process
the problem solving • Computer processes raw data
into usable information to be
and the information used
needed to solve the
>> Output
problem • Output is raw data that has
been processed by the
computer (result).
Below are an example scenario of
Real-time situation

Understand the problem and identify the IPO


• A user using an ATM machine
• Select the appropriate instruction by
Activity 1 categorizing them into input, process
and output.

No ITEM I/P/O
1 Validate and process type of account
2 ATM pin number
3 Type of transaction
4 Monitor show balance in user’s account
5 Identify balance amount in the account
6 Amount of money to withdraw
7 Type of account
8 Money
9 Validate pin number
10 Deducts the withdrawal from the user’s account
11 Receipt
• Below are an example scenario of a
user using an ATM machine
Activity 1 • Select the appropriate instruction by
categorizing them into input, process
and output.

No ITEM I/P/O
1 Validate and process type of account P
2 ATM pin number I
3 Type of transaction I
4 Monitor show balance in user’s account O
5 Identify balance amount in the account P
6 Amount of money to withdraw I
7 Type of account I
8 Money O
9 Validate pin number P
10 Deducts the withdrawal from the user’s account P
11 Receipt O
Complete the activity in LMS (CIDOS)

DFC10042 > Week 5 > ACTIVITY > CLASS ACTIVITY >


IPO : Let's test what you understand
Now let’s test
your problem
solving and logic
thinking skills!
Base on the problem
statement

Identify input, process and output


Example 1

Problem statement:

• Calculate the total of two numbers

Draft the problem analysis:

• Input : ?
• Process : ?
• Output : ?
Example 1

Problem statement:

• Calculate the total of two numbers

Draft the problem analysis:

• Input : Two numbers; Num1, Num2


• Process : Calculate total by add two numbers
• Output : Display total
Well, the correct techniques to be
apply here is through

< IPO CHART>


IPO CHART

Problem Analysis : Identify input, process and output.

Input Process Output

IPO chart (Format)

Input Process Output

Two Calculate total by adding Display total


numbers; the two numbers
Num1, Num2 total = Num1 + Num2
IPO chart (Application Example)
Example 1

Problem statement:

• Calculate the total of two numbers

Problem Analysis (IPO chart):

Input Process Output


Two Calculate total by adding the two Display total
numbers; numbers
Num1, Num2 total = Num1 + Num2
Example 2

Problem statement:
• Write a program that will receive 3 numbers as input from the users.
Find the average and display the three numbers and its average.

Problem Analysis (IPO chart):

Input Process Output


Enter 3 1. Calculate total by add the three 1. Three
numbers numbers numbers
user have
2. Calculate average by divide the entered
total of the three numbers with 3 2. The average
of three
numbers
Example 2

In graphical view, this is what we expect the program to do.

INPUT PROCESS OUTPUT

3 numbers
receive from Program that Display the THREE
user written to process numbers user have
the total of 3 input entered
numbers user
enter Display the AVERAGE
of three numbers
user have entered
Example 3

Problem statement:
• Write a program that will get current year and birth year. Find
the age of the person and display the age of the person.

Problem Analysis (IPO chart):

Input Process Output


1. Enter current Calculate age: Display age
year Age = current year - birth
2. Enter birth year
year
IPO CHART ACTIVITY
In a group of two, prepare an IPO chart for problems below

Index Problem Statements


1 Calculate area of triangle
2 Convert meter to kilometer
3 Calculate total fine for late returning of library
books. The rate for fine is RM 0.50 per day.
4 Calculate the total price for the books. The program
will accept the price of one book and the quantity of
the book.
1. Problem Solving is one of the
method approach towards building
a good program.
2. Different programmer interprets
differently on how to solve a
Conclusion problem.
3. The main task in problem solving is
to identify the Input (I) – Process (P)
– Output(O)
End of
Topic 2– Part 3
Do you have any question ?

See you next class

Sub - Topic :
Algorithm Paterns

You might also like