DFC1023
PROBLEM SOLVING & PROGRAM DESIGN
CHAPTER 2:
PROBLEM SOLVING METHODS
S U B TO P I C 2 .1 : P RO B L E M S O LV I N G
C O N C E PT
AT THE END OF THIS CHAPTER, STUDENTS
SHOULD BE ABLE TO:
Understand Problem solving concept
 Define Input, Process and Output (IPO)
 Identify IPO based on problem given
PROBLEM SOLVING CONCEPT
Methodologies for creating computer programs
that perform a desired function.
How do we figure out what to tell the computer to do?
Convert problem statement into algorithm.
Convert algorithm into program.
PROBLEM SOLVING CONCEPT
1) Input :
 Refers to the process of entering data, program and
instructions into the computer system using input
devices.
 getting data in from the user.
PROBLEM SOLVING CONCEPT
2) Process :
 Computer processes raw data into usable information
to be used by user.
 Data processing is done by the CPU (Central
Processing Unit).
 Processing the input to generate the correct output.
PROBLEM SOLVING CONCEPT
3) Output :
 Output is raw data that has been processed by the
computer (result).
 Output will be converted to an understandable form
before being displayed or printed.
 Display results in a text format, back to the user.
 It might be a message to the user, a request for input,
or the results of some data that the program has
computed.
PROBLEM SOLVING CONCEPT
EXAMPLE: FLOW OF ATM PROGRAM
PROBLEM SOLVING CONCEPT
EXAMPLE : FLOW OF ATM PROGRAM
Input:
• Example: Card number, ATM pin number, type of
transaction, type of account, amount of money to
withdraw.
Process:
• Example : Process to identify card number, valid pin
number, type of transaction, type of account and
deducts the withdrawal from the user’s account.
PROBLEM SOLVING CONCEPT
EXAMPLE : FLOW OF ATM PROGRAM
Output:
• Example: Receipt will show balance in user’s
account and money withdrawn.
PROBLEM SOLVING CONCEPT
EXAMPLE : FLOW OF ATM PROGRAM
EXERCISE
DETERMINE INPUT, PROCESS AND OUTPUT
Problem 1:
Write the program that will get 3 numbers as input from the users. Find the average
and display the average.
Problem 2 :
Calculate the gross pay of an employee. The formula to be used is :
Gross_Pay = Hours_Worked * Pay_Rate
Problem 3 :
Calculate the area of triangle.
SOLUTION :
POLITEKNIK MALAYSIA

POLITEKNIK MALAYSIA

  • 1.
    DFC1023 PROBLEM SOLVING &PROGRAM DESIGN CHAPTER 2: PROBLEM SOLVING METHODS S U B TO P I C 2 .1 : P RO B L E M S O LV I N G C O N C E PT
  • 2.
    AT THE ENDOF THIS CHAPTER, STUDENTS SHOULD BE ABLE TO: Understand Problem solving concept  Define Input, Process and Output (IPO)  Identify IPO based on problem given
  • 3.
    PROBLEM SOLVING CONCEPT Methodologiesfor creating computer programs that perform a desired function. How do we figure out what to tell the computer to do? Convert problem statement into algorithm. Convert algorithm into program.
  • 4.
    PROBLEM SOLVING CONCEPT 1)Input :  Refers to the process of entering data, program and instructions into the computer system using input devices.  getting data in from the user.
  • 5.
    PROBLEM SOLVING CONCEPT 2)Process :  Computer processes raw data into usable information to be used by user.  Data processing is done by the CPU (Central Processing Unit).  Processing the input to generate the correct output.
  • 6.
    PROBLEM SOLVING CONCEPT 3)Output :  Output is raw data that has been processed by the computer (result).  Output will be converted to an understandable form before being displayed or printed.  Display results in a text format, back to the user.  It might be a message to the user, a request for input, or the results of some data that the program has computed.
  • 7.
  • 8.
    PROBLEM SOLVING CONCEPT EXAMPLE: FLOW OF ATM PROGRAM Input: • Example: Card number, ATM pin number, type of transaction, type of account, amount of money to withdraw.
  • 9.
    Process: • Example :Process to identify card number, valid pin number, type of transaction, type of account and deducts the withdrawal from the user’s account. PROBLEM SOLVING CONCEPT EXAMPLE : FLOW OF ATM PROGRAM
  • 10.
    Output: • Example: Receiptwill show balance in user’s account and money withdrawn. PROBLEM SOLVING CONCEPT EXAMPLE : FLOW OF ATM PROGRAM
  • 11.
  • 12.
    DETERMINE INPUT, PROCESSAND OUTPUT Problem 1: Write the program that will get 3 numbers as input from the users. Find the average and display the average. Problem 2 : Calculate the gross pay of an employee. The formula to be used is : Gross_Pay = Hours_Worked * Pay_Rate Problem 3 : Calculate the area of triangle.
  • 13.