You are on page 1of 18

PROBLEM 

SOLVING USING 
COMPUTER
PREPARED BY: MS. SITI HASRINAFASYA CHE HASSAN
REFERENCE TO: SUHANA SULONG, ET. AL.
TOPICS TO BE COVERED

 Typical Simple Problem Solving


 Typical Real World Problem
 Algorithm
 2 Problem Solving Phases:
 Problem Definition
 Algorithm Design
PROBLEM vs. SOLUTION

 What is a problem?
A state of difficulty that needs to be resolved or a
question raised for consideration or solution.

 What is a solution?
 An action to solve a problem.
 2 problem solving strategies: Algorithmic & Heuristic.
ALGORITHMIC vs. HEURISTIC
Algorithmic Solution Heuristic Solution
Its method is a clearly specified Its method involves intelligent
procedure that is guaranteed trial and error or reasoning
to give the correct answer. based on knowledge and
experience.
Examples? Eg: How to become a
millionaire in 21 days?, How to
score straight A’s in exam?
TYPICAL SIMPLE PROBLEM SOLVING

A straightforward problem can be solved by following these steps …

PROBLEM Define
problem

Design
algorithm
Difficult path

Solve
problem
USING PROBLEM SOLVING STRATEGY WILL 
HELP TO SOLVE THE REAL WORLD 
PROBLEM
Control
Transaction problem

REAL WORLD
PROBLEMS
Decision Searching
making problem

Sorting
problem
Example  ATM machine provide many kind of
service to customers such as money
withdrawal, money transfer, check
balance and etc. Customer can choose
any service that they want by choosing
the menu on ATM display.
 selection control structured.
A program MUST be systematically and 
properly designed before coding begins. 
This design process results in the 
construction of an ALGORITHM.
WHAT IS AN ALGORITHM?
 A set of sequential instructions that are followed to solve a
problem.
 In programming terms, it can be defined as a set of detailed,
unambiguous and ordered instructions developed to describe the
processes necessary to produce the desired output from a given
input. PSEUDOCODE AND FLOWCHART ARE 
THE MOST POPULAR WAYS OF 
REPRESENTING ALGORITHMS
PROBLEM SOLVING 
DEVELOPMENT CYCLE
 TWO (2) phases to perform problem solving:
i. Problem Solving phases:
- Problem Definition and Algorithm Design.
ii. Implementation phases:
- Algorithm implementation, program testing and program
maintenance.
Phase 1: Problem Definition

 Purpose: To analyze the problem clearly, precisely and


completely.
 A few things to consider:
i. Input (Data needed)
ii. Process (Formula)
iii. Output (Information required)
iv. A Screen looks like
Example:  Info required: area of a rectangle
Calculate the area  Output)
of a rectangle.
 Formula / Process?
area = length x width
 Input?
length, width
 Screen?
Screen 1:

Enter a length:
Enter a width:
The area of a rectangle:
Screen 2:

Enter a length and a width:


The area of a rectangle:
CHECKPOINT:
Do problem definition for the below problems:

1. Calculate the total of four marks.


2. Calculate the area of three squares.
3. Calculate the circumference or perimeter of a circle that
has 240 cm as its diameter.
4. Calculate the salary of an employee. The data are hours
worked and hourly rate. The salary will be calculated as
hours worked multiply by hourly rate.
CHECKPOINT:
Do problem definition for the below 
problems:
5. Calculate the total salaries for 5 employees. The salary
is paid based on how many hours worked and rate per
hour using formula: salary = rate per hour x hours
worked. Each employee has been paid with the same
rate per hour.
6. Calculate a temperature in Celsius. Temperature in
Fahrenheit will be entered. The formula is: temperature
in Celsius = 5/9(temperature in Fahrenheit – 32).
CHECKPOINT:
Do problem definition for the below 
problems:
7. Calculate the final mark for a student whose take paper

CSC118. The mark is the total of carry mark and 60% of


final exam. The carry mark is calculated as follows:
Carry mark = 20% of test mark + 20% of quiz mark.
Test mark is an average of three tests and quiz mark is
an average of four quizzes.
CHECKPOINT:
Do problem definition for the below 
problems:
8. Calculate the net salary for a worker. The net salary is
the different of gross salary and total deduction. The
gross salary is the total of basic salary and total
allowances. The allowances are housing allowance,
telephone allowance and transportation. Each of
allowance are RM500, RM700, and RM750. The worker
has to contribute to EPF deduction 9% of gross pay and
contribution for SOCSO 2% of gross pay.

You might also like