Tuesday, July 26, 2011

Selection and Repetition

Algorithms:

1.Moving through a set of traffic lights
- Check whether the traffic light are green, red or yellow
- Decide which direction you would like to turn if its a green light you have to drive if its a yellow you need to get ready to see the red light it means you must stop driving for either a pedestrian or for other cars travelling in other directions
- keep dping the same thing following the road rules and you can smoothly move away from the traffic lights

2.Deciding whether to take an umbrella to school
- Look at the weather outside
- if you see a blue sky then you can leave your umbrella at home
-if you see a grey sky or clouds starting to move toghther take your umbrellla to school.
- put your umbrella in your bag because the weather does often change and it could rain to your surprise!

3.Ging a student and A, B or C on there test
- Check the students work
- see if they have made any spelling or punctuation error
- if the student deserves an A for there work there should be very little mistakes and clear understandable work with an extensive knowledge towards whata it is about
- if the student deserves a B then there work should have a few mistakes and understand what the test was about the student must have made the work clear with a high level of knowlegde used.
- if the student deserves a C there work needs to atleast have a sound levelof acheivement and needs to work more on therere spelling and punctuation and also must have used some knowledge to answer.
- Mark the student an A,B or C according to the critera

Repetition in an algorithm:

1. Adding the correct amount of cordial to water to make a drink
- pour a small amount of cordial into the glass as it is really sweet the bottom of the cup should be filled with cordial
- addd water to the cordial so that it dilutes the cordial
- taste the cordial to see if you have added the right amount of water
-if you have then drink it
- if you havent added enough water then you have to add water to the cordial again
- keep adding more cordial or more water to make the cordial to you tasting.

2. Filling a bucket with water
- Get a bucket to a size that you like
- Open a tap or a place where you have acceess to water
- Turn the tap on and keep on filling the bucket until the water reaches the top
- repeat this proccess if you would like more water in the bucket.

3. Blowing up a balloon
- Get a balloon and put your mouth around the top rim
- blow into the ballon so that you are pushing air into it
- continue blowing air into the ballon making sure not to let go
- after you are done dont let go of the balloon and tie the end of it into a knot


http://en.wikipedia.org/wiki/Algorithm

No comments:

Post a Comment