1 / 11

Program Development Procedures

Program Development Procedures Program definition clearly define what the problem is. clearly define Input and output data (types, precision, units used) and processes for the problem Program Analysis Break down a complicated program into modules

grahams
Download Presentation

Program Development Procedures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program Development Procedures • Program definitionclearly define what the problem is.clearly define Input and output data (types, precision, units used) and processes for the problem • Program AnalysisBreak down a complicated program into modules • Algorithm Designstep by step procedures in form of pseudocode or flowchart3 construct structures (sequence, selection, iteration) • Program codingconvert algorithm into program • Program debugging /Testingdebug syntax, run-time,logic errorTest with data • Program Documentation(flow of program development procedures)

  2. Problem definition • 1.1 clearly define what the problem is. • “ A teacher wants to know the student’s performance on the Computer & Information Technology subject. • Not clear !  • “ A teacher has to determine whether a student has obtained a pass or a failure in the Computer & Information Technology subject. A pass will require the student to have 50 or above for the final score on the subject. The final score, in turn, is calculated from the test score and the examination score, with weights 30% and 70% respectively” • More Clear. 1.2 clearly define Input ,output data (types, precision, units used) and processes for the problem

  3. 2. Problem analysis (Top down design approach) Break down a complicated program into modules Techniques Stepwise refinementBlock diagram Visualize relationship among modules • First level refinement • Get Scores • Check pass/fail • Output result • Further refinement • 1. Get Score 1.1 Get test score 1.2 Get exam score • 2. Check pass/fail 2.1 Calculate final score 2.2 Check final score status • 3. Output result Pass or Fail in CIT Get Score Check pass/fail Output result Pass or Fail in CIT Get Score Check pass/fail Output result Get Test Score Get Exam Score Calculate Final Score Check Final scoreStatus

  4. Get Score Check pass/fail Output result Get Test Score Get Exam Score Calculate Final Score Check Final score Status Pass or Fail in CIT Get Score Check pass/fail Output result Calculate Final Score Check Final score Status Get TestScore Get ExamScore • 2. Problem analysis- (Bottom-up design approach) • Identify modules first as building blocks for larger tasks. • Techniques • Block diagram • Creating modules Check Final score Status Check Final score Status Get Test Score Get Exam Score Output result • Put related modules together to build up larger tasks • Continue to put related tasks together to build up original problem Problem analysis- (Trial and Error Design) list out tasks that make up the problem from the start further break down or join tasks as you see fit.

  5. 3. Algorithm design step by step procedures 3 construct structures (Pseudocode, flowchart) Sequence Straight forward execution of one action after another. statement a statement b statement c Selection (represent a condition and a choice between two actions, depending on true or false of the condition) If condition p is true then statement a else statement b If condition p is true then statement a flowchart t f statement a Condition p true? statement b statement a statement b statement C t Condition p true? statement a e.g. If you have $100000 then then output “you are rich” else output “ you are poor” e.g. If you have $100000 then then output “you are rich”

  6. f Condition p true? t statements Iteration(A group of actions is performed repeatedly, as long as condition is true) do while condition p is true statement block enddo flowchart e.g. Do while you have money buy some items Enddo Repeat statement block Until condition p is true statements e.g. repeat buying some items until you have no money f Condition p true?

  7. START Further refinement 1. Get Score 1.1 Get test score 1.2 Get exam score 2. Check pass/fail 2.1 Calculate final scpre 2.2 Check final score status 3. Output result flowchart Input Testscore input Examscore FinalScore=Testscore * 0.3 +ExamScore * 0.7 t f Final Score>=50 Status = “FAIL” Status = “PASS” Output Status END Algorithm design Algorithms 1.1 Get Testscore 1.2 Get ExamScore 2.1 Final Score = TestScore * 0.3 + ExamScore * 0.7 2.2 If Final Score >= 50 then set Status to “Pass” Else set Status to “Fail” 3 Output Status

  8. 4. Program coding convert algorithm into program selection of programming language good programming style (readability and modularity) Program MRSIN; Var TestScore, ExamScore, Finalscore : real; Status: string; Begin writeln (‘Enter the Test score:’); readln(Testscore); write (‘Enter the Examination score:’); readln(Examscore); Finalscore := TestScore * 0.3 + Examscore * 0.7; if Finalscore >= 50 then Status := ‘Pass’ else Status := ‘FAIL’; writeln(Status) End.

  9. 5. Debugging/testing (program errors)syntax (grammer, missing punctuation during compilation)run-time error (infinite loop, mismatch type, division by zero, overflow, out of memory )logic error (Incorrect algorithm) Identify errors below and state the type of errors Program FinalScore; Var TestScore, ExamScore : real; FinalScore: integer; Status: char; Begin write (‘Enter the Test score:’) readln(Testscore); write (Enter the Examination score:); readln(Examscore); Finalscore = TestScore * 0.3 + Examscore * 0.7; if Finalscore < 50 then Status = ’PASS’ else; Status = ‘FAIL’; writeln(Statu) End.

  10. Program test (logic error) Run program with different sets of test data Tracing program flow, identifying values of variables (watch) Try Testscore < 0 or Examscore <0 Program CheckPass; Var TestScore, ExamScore, FinalScore : real; Status: string; Begin write (‘Enter the Test score:’); readln(Testscore); write (‘Enter the Examination score:’); readln(Examscore); Finalscore := TestScore * 0.3 + Examscore * 0.7; if Finalscore >= 50 then Status := ‘Pass’ else Status := ‘FAIL’; writeln(Status) End.

  11. 6 . Documentation (flow of program development procedures) • Title • Specification of program • Algorithm and flowchart • List and definitions of variables • List of files used. • Annotated program listing source code (comments) • Test data • Sample output • User manual

More Related