Presentation is loading. Please wait.

Presentation is loading. Please wait.

Program Development Procedures 1.Program definition clearly define what the problem is. clearly define Input and output data (types, precision, units used)

Similar presentations


Presentation on theme: "Program Development Procedures 1.Program definition clearly define what the problem is. clearly define Input and output data (types, precision, units used)"— Presentation transcript:

1 Program Development Procedures 1.Program definition clearly define what the problem is. clearly define Input and output data (types, precision, units used) and processes for the problem 2.Program Analysis Break down a complicated program into modules 3.Algorithm Design step by step procedures in form of pseudocode or flowchart 3 construct structures (sequence, selection, iteration) 4.Program coding convert algorithm into program 5.Program debugging /Testing debug syntax, run-time,logic error Test with data 6.Program Documentation (flow of program development procedures)

2 1.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 InputProcessOutput VariablesTypePrecisionunits Get scores Calculate final score Check pass/fail Output result VariablesTypePrecisionunits Testscore Examscore decimal1 decimal place Status “Pass”, “Fail” Text FinalScoredecimal1 decimal place

3 2. Problem analysis (Top down design approach) Break down a complicated program into modules Techniques Stepwise refinement Block diagram First level refinement 1.Get Scores 2.Check pass/fail 3.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 Visualize relationship among modules Pass or Fail in CIT Get ScoreCheck pass/failOutput result Pass or Fail in CIT Get ScoreCheck pass/failOutput result Get Test Score Get Exam Score Check Final score Status Calculate Final Score

4 2. Problem analysis- (Bottom-up design approach) Identify modules first as building blocks for larger tasks. Techniques Block diagram Creating modules Get Test ScoreGet Exam ScoreCheck Final score StatusOutput result Put related modules together to build up larger tasks Get Score Output result Get Test ScoreGet Exam Score Check pass/fail Calculate Final ScoreCheck Final score Status Continue to put related tasks together to build up original problem Check Final score Status Pass or Fail in CIT Get Score Check pass/fail Output result Get TestScoreGet ExamScore Check Final score StatusCalculate Final Score 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 Condition p true? t f statement bstatement a Condition p true? t statement a statement b statement C statement a flowchart 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 Iteration (A group of actions is performed repeatedly, as long as condition is true) do while condition p is true statement block enddo Condition p true? t statements f flowchart Repeat statement block Until condition p is true Condition p true? statements f e.g. Do while you have money buy some items Enddo e.g. repeat buying some items until you have no money

7 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 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 Output Status Input Testscore input Examscore Final Score>=50 t f Status = “FAIL”Status = “PASS” FinalScore=Testscore * 0.3 +ExamScore * 0.7 START END flowchart

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) 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. Identify errors below and state the type of errors

10 Program test (logic error) Run program with different sets of test data Tracing program flow, identifying values of variables (watch) 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. Try Testscore < 0 or Examscore <0

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


Download ppt "Program Development Procedures 1.Program definition clearly define what the problem is. clearly define Input and output data (types, precision, units used)"

Similar presentations


Ads by Google