140 likes | 316 Views
Chapter 13 Problem solving procedures. Step1- problem identification. define the problem Interview discussion Think and make some question What are the causes of the problem?? Which program do you need to solve the problem??. Step2- problem analysis.
E N D
Step1- problem identification • define the problem • Interview • discussion • Think and make some question What are the causes of the problem?? Which program do you need to solve the problem??
Step2- problem analysis • Input-process-output chart (IPO chart) • Complete understanding the problem • Find the information to solve • Example: Make a website
Step3- algorithm design Flow of solution Find and considering the possible ways to solve Flowchart • Use graph • Show the steps or process as boxes • Order by connecting with arrows • represent a solution algorithm.
pseudocode • Use short English-like phrase to explain the task or process • No specific computer languages is used Advantage: • Save time to write • Easy to understand and organize your thoughts
Step4- developing a solution • Select the best ways • Structure diagram • Divide the problem into sub-problem - divide and conquer
Advantage of breaking down the problem into sub-problem : easy to find the mistakes in the process easy to solve the problem know the process clearly systematically to handle
Step5- Debugging and testing • Sure the program work and avoid some mistakes • syntax error • Logic error • Run-time error
Syntax error • mistyping wrong programming language command • Program cannot be translated • Easy to find out mistakes • Example: <img sc=“http://www.istockphoto.com/file_closeup.php?id=161739"”> Cannot show the pictures
Logic error • Program gives a wrong result • can function normally • Difficult to find the mistakes • cannot be defeated by program • only be detected by human • Example: If age < 17 then (should be age>17)print "I am a adult“End If
Run-time error • during the running of a program • The problem will stop Example: • running out of memory • Division by zero
Step6- documentation Two documents to write • Users manual • Program manual
Users manual Target : users Purpose : • tell users how to use the program • Teach users how to handle errors
Program manual • Target : programmer • Purpose : • - programmers maintain the program in the future • Items included : flowcharts, testing report