0
Mr.Warawut Khangkhan           Twitter: http://twitter.com/awarawutFacebook: http://www.facebook.com/AjWarawut            ...
Objective 1.                                           F 2.          F                    F                               ...
Contents    Steps in Program Development    Program Design Methodology                   Procedural  Object-Oriented    Ob...
Mr.Warawut   Chapter 1 Review   4
Steps in Program Development 1.             (Define the Problem) 2.     F                 F     (Outline the Solution) 3. ...
Define the Program    Inputs    Outputs    ProcessingMr.Warawut       Chapter 1 Review   6
Outline the Solution                         F           F                              (       )             F           ...
Develop and Algorithm                F                       F             F (Pseudo Code)                F F             ...
Test the Algorithm for Correctness                                    F   F             FMr.Warawut       Chapter 1 Review...
Programming                 F                          F   F   F    (        )        F                  (High Language)  ...
Testing          F        F                          F       F   F       F                  (Syntax Errors)              (...
Document and Maintain theProgram                                                     F   F                 F              ...
Mr.Warawut   Chapter 1 Review   13
Program Design Methodology                                                         Procedure-Driven                       ...
Mr.Warawut   Chapter 1 Review   15
ProceduralObject-Object-Oriented                    F (Top-Down Development)                         (Modular Design)     ...
F                                        F                               Control Module                                   ...
F          : http://www.chapterpiece.com/software-development-       process/2010/04/13/how-to-build-software-3/Mr.Warawut...
Mr.Warawut   Chapter 1 Review   19
Objective of Structured ProgramDesign Techniques 1.         F       F                                           F        F...
Mr.Warawut   Chapter 1 Review   21
Introduction to Algorithm andPseudo Code Algorithm      F                                     F               F   F       ...
Example Algorithm                 F 1. 2.      F               F 3.                                F 4. 5.          F 6. 7...
F                     F 1.              F       F                  F   F           F         F 2.              F          ...
Example Algorithm                F turn on calculator clear calculator repeat the following instructions    key in baht am...
Introduction to Algorithm andPseudo Code (Cont.) Pseudo Code      F          F                        F            FMr.War...
F 1.         F                                           (Statement) F                              F                     ...
Mr.Warawut   Chapter 1 Review   28
Six Basic Computer Operations 1.              F            F             F 2.              F                              ...
F                                      F                         F                   F       F       (       ) F      F   ...
F                                               F F                F         F           print, write, put, output        ...
F                                      F F (Cont.)             prompt          F               F       F   F   get,   F   ...
F                                  F             F       F                     F+ F                  (add)                ...
F                                  F                       F                  F3 1.           F        initialize         ...
F    F        F if…then…else                 F   end if         if employeeStatus is partTime then            add 1 to par...
F                                     F       F dowhile…enddo                    repeat…until         dowhile file_flag <>...
Mr.Warawut   Chapter 1 Review   37
The Three Basic Control Structures    Sequence    Selection    RepetitionMr.Warawut       Chapter 1 Review   38
Sequence Format  statement a  statement b  statement c     :     :Mr.Warawut      Chapter 1 Review   39
Example: Sequence  add 1 to pageCount  print heading line1  print heading line2  set lineCount to zero  read customer reco...
Selection Format  if condition p is true then     statement(s) in true case  else     statement(s) in false case  end ifMr...
Example: Simple IF Statement  if accountBalance < 300000 then     serviceCharge = 5.00  else     serviceCharge = 2.00  end...
Example: Null False Branch  if employeeStatus = partTime then     add 1 to partTimeCount  end ifMr.Warawut    Chapter 1 Re...
Example: Combined IF Statement 1  if employeeStatus = partTime     and employeeGender = female then       add 1 to partTim...
Example: Combined IF Statement 2  if (recordCode = “23” or updateCode = delete)     and accountBalance = zero then        ...
Example: Combined IF Statement 3  if not (recordCode = “23”     and updateCode = delete) then        update customer recor...
Example: Nested IF Statement 1 if recordCode = “A” then    increment counter_A else    if recordCode = “B” then       incr...
Example: Nested IF Statement 2 if employeeStatus = partTime then    if employeeGender = female then       if employeeAge >...
Repetition Format dowhile  dowhile condition p is true    statement block  enddoMr.Warawut     Chapter 1 Review   49
Repetition Format (Cont.) repeat…until  repeat     statement     statement        :        :  until condition is trueMr.Wa...
Example: dowhile loop 1  set studentTotal to zero  dowhile studentTatal < 50     read student record     print studentName...
Example: dowhile loop 2  Process Student_record     set studentCount to zero     read student record     dowhile studentNu...
Example: repeat…until loop Process Student_record    set studentCount to zero    repeat       read student record       if...
Upcoming SlideShare
Loading in...5
×

พื้นฐานการออกแบบโปรแกรม

523

Published on

พื้นฐานการออกแบบโปรแกรม (Fundamental of Program Design)

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
523
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "พื้นฐานการออกแบบโปรแกรม"

  1. 1. Mr.Warawut Khangkhan Twitter: http://twitter.com/awarawutFacebook: http://www.facebook.com/AjWarawut E-mail: awarawut@hotmail.com Mobile: 083-0698-410
  2. 2. Objective 1. F 2. F F F 3. F F Procedural Object-Oriented F 4. F F 5. F F 6. F 6 F F F F FMr.Warawut Chapter 1 Review 2
  3. 3. Contents Steps in Program Development Program Design Methodology Procedural Object-Oriented Objective of Structured Program Design Techniques Introduction to Algorithm and Pseudo Code Six Basic Computer Operations The Three Basic Control StructuresMr.Warawut Chapter 1 Review 3
  4. 4. Mr.Warawut Chapter 1 Review 4
  5. 5. Steps in Program Development 1. (Define the Problem) 2. F F (Outline the Solution) 3. (Develop and Algorithm) 4. F (Test the Algorithm for Correctness) 5. (Programming) 6. (Testing) 7. (Document and Maintain the Program)Mr.Warawut Chapter 1 Review 5
  6. 6. Define the Program Inputs Outputs ProcessingMr.Warawut Chapter 1 Review 6
  7. 7. Outline the Solution F F ( ) F F F F F F F F (Subtask) F F F F F F F F F (Logic)Mr.Warawut Chapter 1 Review 7
  8. 8. Develop and Algorithm F F F (Pseudo Code) F F FMr.Warawut Chapter 1 Review 8
  9. 9. Test the Algorithm for Correctness F F FMr.Warawut Chapter 1 Review 9
  10. 10. Programming F F F F ( ) F (High Language) F C, PASCAL FMr.Warawut Chapter 1 Review 10
  11. 11. Testing F F F F F F (Syntax Errors) (Logic Errors) F F F F F FMr.Warawut Chapter 1 Review 11
  12. 12. Document and Maintain theProgram F F F F F (External Document) F F F F F (Internal Document) FMr.Warawut Chapter 1 Review 12
  13. 13. Mr.Warawut Chapter 1 Review 13
  14. 14. Program Design Methodology Procedure-Driven - (Processes) F (Functions) Event-Driven - F F F F F F Data-Driven - F F F F F F F F F F F F F F F F F F F F F F F FMr.Warawut Chapter 1 Review 14
  15. 15. Mr.Warawut Chapter 1 Review 15
  16. 16. ProceduralObject-Object-Oriented F (Top-Down Development) (Modular Design) (Object-Oriented Programming)Mr.Warawut Chapter 1 Review 16
  17. 17. F F Control Module start call module 1 call module 2 call module 3 stop Module 1 Module 2 Module 3 begin begin begin do 1 do x if x then y do 2 do y else z do 3 do z do abc return return returnMr.Warawut Chapter 1 Review 17
  18. 18. F : http://www.chapterpiece.com/software-development- process/2010/04/13/how-to-build-software-3/Mr.Warawut Chapter 1 Review 18
  19. 19. Mr.Warawut Chapter 1 Review 19
  20. 20. Objective of Structured ProgramDesign Techniques 1. F F F F F F 2. F FF 3. F F F 4.Mr.Warawut Chapter 1 Review 20
  21. 21. Mr.Warawut Chapter 1 Review 21
  22. 22. Introduction to Algorithm andPseudo Code Algorithm F F F F F F F F F F F F F F F FMr.Warawut Chapter 1 Review 22
  23. 23. Example Algorithm F 1. 2. F F 3. F 4. 5. F 6. 7. 3Mr.Warawut Chapter 1 Review 23
  24. 24. F F 1. F F F F F F 2. F F F F F F 3. F F F F F F 4. FMr.Warawut Chapter 1 Review 24
  25. 25. Example Algorithm F turn on calculator clear calculator repeat the following instructions key in baht amount key in decimal point (.) key in satang amount press addition(+) key until all prices have been entered write down total price turn off calculatorMr.Warawut Chapter 1 Review 25
  26. 26. Introduction to Algorithm andPseudo Code (Cont.) Pseudo Code F F F FMr.Warawut Chapter 1 Review 26
  27. 27. F 1. F (Statement) F F F F 2. F 3. F F F F F (Keywords) F F F F F F FF F 4. F F F F F 5. F F F F F F F F F F F FMr.Warawut Chapter 1 Review 27
  28. 28. Mr.Warawut Chapter 1 Review 28
  29. 29. Six Basic Computer Operations 1. F F F 2. F F F 3. F F 4. F F F 5. F F 6. F FMr.Warawut Chapter 1 Review 29
  30. 30. F F F F F ( ) F F F F F F F F F F F F F F F F F F F F F F F F read get F F read F F F F F get F F F F read studentName get systemDate read number1, number2 get taxCodeMr.Warawut Chapter 1 Review 30
  31. 31. F F F F F print, write, put, output display print F F F F write F F F F put, output display F F F print “Program Completed” write customer record to master file put name, address and postcode output totalTax display “End of data”Mr.Warawut Chapter 1 Review 31
  32. 32. F F F (Cont.) prompt F F F F get, F F F F F F promt for studentMark get studentMarkMr.Warawut Chapter 1 Review 32
  33. 33. F F F F F+ F (add) F– F (subtract) F* F (multiply) F/ F (divide) F() F / F F F compute calculate divide totalMarks by studentCount salesTax costPrice * 0.10 compute C = (F – 32) * 5 / 9Mr.Warawut Chapter 1 Review 33
  34. 34. F F F F3 1. F initialize F set F F F 2. F F = F F 3. F store F F initialize totalPrice to zero set studentCount to 0 totalPrice = costPrice + salesTax totalPrice costPrice + salesTax store customerId in lastCustomerIDMr.Warawut Chapter 1 Review 34
  35. 35. F F F if…then…else F end if if employeeStatus is partTime then add 1 to partTimeCount else add 1 to fullTimeCount end ifMr.Warawut Chapter 1 Review 35
  36. 36. F F F dowhile…enddo repeat…until dowhile file_flag <> “eof” read student record print studentName, address to report add 1 to studentTotal enddo eof – End Of FileMr.Warawut Chapter 1 Review 36
  37. 37. Mr.Warawut Chapter 1 Review 37
  38. 38. The Three Basic Control Structures Sequence Selection RepetitionMr.Warawut Chapter 1 Review 38
  39. 39. Sequence Format statement a statement b statement c : :Mr.Warawut Chapter 1 Review 39
  40. 40. Example: Sequence add 1 to pageCount print heading line1 print heading line2 set lineCount to zero read customer recordMr.Warawut Chapter 1 Review 40
  41. 41. Selection Format if condition p is true then statement(s) in true case else statement(s) in false case end ifMr.Warawut Chapter 1 Review 41
  42. 42. Example: Simple IF Statement if accountBalance < 300000 then serviceCharge = 5.00 else serviceCharge = 2.00 end ifMr.Warawut Chapter 1 Review 42
  43. 43. Example: Null False Branch if employeeStatus = partTime then add 1 to partTimeCount end ifMr.Warawut Chapter 1 Review 43
  44. 44. Example: Combined IF Statement 1 if employeeStatus = partTime and employeeGender = female then add 1 to partTimeCount end ifMr.Warawut Chapter 1 Review 44
  45. 45. Example: Combined IF Statement 2 if (recordCode = “23” or updateCode = delete) and accountBalance = zero then delete customer record end ifMr.Warawut Chapter 1 Review 45
  46. 46. Example: Combined IF Statement 3 if not (recordCode = “23” and updateCode = delete) then update customer record end ifMr.Warawut Chapter 1 Review 46
  47. 47. Example: Nested IF Statement 1 if recordCode = “A” then increment counter_A else if recordCode = “B” then increment counter_B else if recordCode = “C” then increment counter_C else increment errorCounter end if end if end ifMr.Warawut Chapter 1 Review 47
  48. 48. Example: Nested IF Statement 2 if employeeStatus = partTime then if employeeGender = female then if employeeAge > 30 then add 1 to matureFemaleEmployee else add 1 to youngFemaleEmployee end if else add 1 to maleEmployee end if else add 1 to fullTimeEmployee end ifMr.Warawut Chapter 1 Review 48
  49. 49. Repetition Format dowhile dowhile condition p is true statement block enddoMr.Warawut Chapter 1 Review 49
  50. 50. Repetition Format (Cont.) repeat…until repeat statement statement : : until condition is trueMr.Warawut Chapter 1 Review 50
  51. 51. Example: dowhile loop 1 set studentTotal to zero dowhile studentTatal < 50 read student record print studentName, address to report add 1 to studentTotal enddoMr.Warawut Chapter 1 Review 51
  52. 52. Example: dowhile loop 2 Process Student_record set studentCount to zero read student record dowhile studentNumber not equal 999 write student record increment studentCount read student record enddo print studentCount endMr.Warawut Chapter 1 Review 52
  53. 53. Example: repeat…until loop Process Student_record set studentCount to zero repeat read student record if studentNumber not equal 999 write student record increment studentCount end if until studentNumber = 99 print studentCount endMr.Warawut Chapter 1 Review 53
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×