Presentation is loading. Please wait.

Presentation is loading. Please wait.

Phil Campbell London South Bank University Pseudocode Process Modelling.

Similar presentations


Presentation on theme: "Phil Campbell London South Bank University Pseudocode Process Modelling."— Presentation transcript:

1 Phil Campbell London South Bank University Pseudocode Process Modelling

2 Phil Campbell London South Bank University Simple explanation of the steps to achieve a task Can be reduced to Sequence Selection Iteration Pseudocode Step follows step Choose which steps to follow depending on some condition Repeat steps a number of times

3 Phil Campbell London South Bank University Sequence begin wake up get out of bed shower dress eat end The order is important All steps must be done Each step may be expanded begin wake up get out of bed //shower go to bathroom take shower towel dry dress eat end

4 Phil Campbell London South Bank University Selection begin if hungry then eat breakfast end if end hungry is either true or false hungry is a boolean condition begin if hungry then eat breakfast else drink coffee end if end Must either eat breakfast or drink coffee but not both.

5 Phil Campbell London South Bank University Selection hungry is either true or false hungry is a boolean condition begin hungry if hungry=true then eat breakfast else drink coffee end if end begin if hungry then eat breakfast else drink coffee end if end

6 Phil Campbell London South Bank University Selection hungry is either true or false hungry is a boolean condition begin hungry if hungry=false then eat breakfast else drink coffee end if end begin if hungry then eat breakfast else drink coffee end if end

7 Phil Campbell London South Bank University Selection begin select preference case cereal: check milk in fridge case sausages : get frying pan case eggs : check use by date case toast: open bread bin end select end One and only one of the preferred actions will take place.

8 Phil Campbell London South Bank University Iteration begin while hungry eat end while end As long as the hungry condition is true keep eating begin make toast for each slice of toast spread butter eat end for end

9 Phil Campbell London South Bank University Iteration begin move forward... end begin while can move forward move forward end while end

10 Phil Campbell London South Bank University Storing Values begin total <- 0; for each student add one to total end for display " value is " total; end increment totaltotal <- total + 1total++ Count the number of students

11 Phil Campbell London South Bank University Storing Values begin totalHeight <- 0; count <- 0 for each student add student height to totalHeight increment count end for result <- totalHeight / count display "result is " result end

12 Phil Campbell London South Bank University begin totalHeight <- 0; count <- 0 for each student add student height to totalHeight increment count end for result <- totalHeight / count display "result is " result end Student Heights 0 totalHeight 0 count 1.75 result Result is 1.75 find the average height of a set of students

13 Phil Campbell London South Bank University UML Activity Diagram begin wake up get out of bed shower dress eat end wake up get out of bed shower dress eat

14 Phil Campbell London South Bank University UML Activity Diagram begin if hungry then eat breakfast end if end [not hungry] eat breakfast [hungry]

15 Phil Campbell London South Bank University UML Activity Diagram begin if hungry then eat breakfast else drink coffee end if end eat breakfast drink coffee [hungry] [not hungry]

16 Phil Campbell London South Bank University UML Activity Diagram begin while hungry eat end while end eat [hungry] [not hungry]

17 Phil Campbell London South Bank University Answer to robot (general) begin while not at target turn left while not can move turn right end while move forward end while end

18 Phil Campbell London South Bank University Robot class


Download ppt "Phil Campbell London South Bank University Pseudocode Process Modelling."

Similar presentations


Ads by Google