Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing a Program.

Similar presentations


Presentation on theme: "Developing a Program."— Presentation transcript:

1 Developing a Program

2 Writing a program Defining the problem Planning Programming
Write down what the program will do Planning Write down the steps, draw a flowchart Programming Coding, including errors correction, testing Documenting Adding comments Implementing Improvement, making the program better

3 Objective A program can be divided into 3 parts: Input data
Processing data – Calculation, etc. Output information/results Calculation/ Processing Input Output

4 A Diagram that uses special symbols showing the steps of a program
Planning - Flowchart A Diagram that uses special symbols showing the steps of a program

5 What is a flowchart? A diagram made up of symbols of various shapes connected by arrows. Those symbols indicate either actions to be taken or decisions to be made. It may be used to describe any complicated process when a mixture of actions & decisions take place It helps us planning & programming.

6 Flowchart Symbols T F Decision symbol
(Selection, Conditional Statement) Terminal symbol (Start & Stop) Page connector (used when run out of room at the bottom) 2 Processing symbol (Calculate, Assign, Initialize, Declare) 1 Step connector (go from one part to another) A Input/Output symbol (get, put) A

7 Terminal Symbol start stop Only one “start” & one “stop” 1 arrow only
Each flowchart starts with one “start” & ends with one “stop” start stop

8 Input / Output Symbol 2 arrows only Input Data Display result
1 in & 1 out Input Data get fullname:* Display result put fullname

9 Processing Symbol 2 arrows only Declaration Initialization Calculation
1 in & 1 out Declaration var sum : real Initialization sum := 30.14 Calculation

10 Decision Symbol T Q. ? F 3 arrows Question 2 out going arrows
1 in & 2 out Question worded this way that the answer is Yes or No 2 out going arrows T (True, Yes) F (False, No) Q. ? T F

11 Loop and Block For/while/do와 같은 반복문 여러 개의 명령어로 구성된 Block

12 Page connector 2 1 1 arrow only Shows the next page
Shows the previous page Run out of space

13 Step connector A A 1 arrow only Appear in Use letters
Many to 1 Use letters Go from one step to another A A

14 Arrows From Top to Bottom & from Left to Right Make turn Join together

15 Example start 1.is it the door bell? 2.start 3.answer the phone
4.turn off the alarm 5.is it the telephone? 6.listen to bell ringing 7.stop 8.see who is at the door bell ringing N N turn off the alarm phone? door? Y Y answer the phone see who is at the door stop

16 Example const PI := 3.14 var radius, volume : real
start Define PI const PI := 3.14 var radius, volume : real put “please enter...”.. get radius volume := (4/3)*PI*radius**3 put “” put “The volume is”, volume Declare radius, volume ask radius input radius Calculate volume output volume stop

17 Example start 1.start declare variables 2.what is the mark
var mark: real _____ mark mark stop A T F ask mark 1.start declare variables 2.what is the mark 3.ask for mark 4.check mark>=50 5.>=50 show “U Pass” 6.<50 show “U Fail” 7.stop get “U Pass” >=50 “U Fail”

18 Example with Trace Table
start x y sum Declare & Initialise x & y to1 1 1 2 1 2 3 A is sum<20 sum of x&y Y x = y y = sum 2 3 5 3 5 8 N A Show x,y and sum 5 8 13 8 13 21 stop

19 Programming Convert the steps to instructions / programming languages
Debug – correct the errors Syntax errors Grammar mistakes which are easily found out Logical errors Programs run & work but the outcome is not correct / expected Can be found by testing

20 Documentation Add comments Use spaces wisely
Easier to understand Use spaces wisely Blanks, Tabs, New Lines Easy to trace, follow & understand Choose variables & constants names Easy to understand, not too long or short

21 Implementation Ask others to run your program
Make it more user friendly including input & output Make it more efficient (fewer lines) Make it run faster Add ending screen etc.


Download ppt "Developing a Program."

Similar presentations


Ads by Google