Download presentation
Presentation is loading. Please wait.
Published byDennis Carpenter Modified over 9 years ago
1
1 Program Development l Problem definition l Problem analysis l Algorithm design l Program coding l Program testing l Program documentation
2
Problem Definition
3
3 ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. Here is our problem.
4
Problem Analysis
5
5 ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. How to solve the problem?
6
6 Problem Analysis - Input ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. â A starting Date â The number of days that follows First, identify the input.
7
7 Problem Analysis ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. The output is next, right?
8
8 Problem Analysis - Output ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. Very Good! â The date n days after the input date
9
9 Problem Analysis ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. What about the algorithm?
10
10 Problem Analysis ?The computer accepts a date of the year 1994 and outputs the date n days after the input date. II e got a solution!
11
Algorithm Design Top-down Modular Approach
12
12 Top-down Modular Design This is our initial problem Look_Up_Date
13
13 Structure Chart - Level 1 Look_Up_Date Break the problem down into subproblems Initialization Get_Input Calculate_Date Output_Date
14
14 Structure Chart - Level 2 Look_Up_Date Calculate_DateGet_InputInitializationOutput_Date Input Starting Input Number. Date of days Further break down if necesary
15
15 Structure Chart Completed Done! Look_Up_Date Input Starting Date Calculate_DateGet_InputInitialization Input Number of Days Output_Date
16
Program Coding Pseudocode
17
17 Pseudocode 1. Initialization 2. Get_Input 3. Calculate_Date 4. Output_Date
18
18 Step-wise Refinement 2.1 Input Starting Date 2.2. Input Number of Days 1. Initialization 2. Get_Input 3. Calculate_Date 4. Output_Date
19
Program Coding Programming Language Pascal
20
program Look_Up_Date; { variable declarations } : { procedure declarations } : begin Initialization; Get_Input; Calculate_Date; Output_Date end.
21
program Look_Up_Date; { variable declarations } var Year, Month, Day : integer; { procedure declarations } : begin Initialization; Get_Input ( Year, Month, Day ); Calculate_Date ( Year, Month, Day ); Output_Date ( Year, Month, Day ) end.
22
Program Tesing & Debugging
23
23 Test Cases l Choose suitable test cases l Beware of Boundary Conditions l For Example, to test a program which decides whether an input number is greater than or equal to 100. l Three test cases should be used. l Do you know which three ?
24
24 Test cases (Continue...) l (1)any numbers small than 100 e.g. 50 l (2)the number 100 l (3) any numbers greater than 100 e.g. 200
25
Program Documentation
26
26 The End l Prepared by l Mr. Chan Hing Man (96044060)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.