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

Monday, July 25, 2011

What is an algorithm

Algorithms
1. Examine the algorithm above. What two properties of the algorithm enable it to correctly describe the solution to the problem of making a cup of coffee? What is it that makes an algorithm correct?(Hint: what would happen if you swapped step "6" and step "2"?)
If step two and step six were swapped it wouldn’t really make sense because then you will be stirring an empty cup

2. Define Algorithms for the following processes.

Posting a letter.
1. Write the letter
2. Place the letter in an envelope
3. Put the envelope in the post box

Making toast.
1. Get the bread out
2. Set up the toaster
3. Put the toast in the toaster

Calling a friend on the phone
1. Get the phone
2. Find your friends number
3. Dial that number and call

Thursday, July 21, 2011

Coin toss flowchart

4. Create a flowchart for a coin toss where heads means mary pays for the pizza and tales means bill pays for the pizza.

Tuesday, July 19, 2011

Flowchart basics

1. What is a flowchart?


A flowchart us graphic representation, using symbols interconnected with lines, of the successive steps in a procedure or system.


2. Describe the basic symbols for;
*Start or end of the program


At the start or end of a flowchart an oval shape is used.


*Input or output operation


A parallelogram is used to show input or output.


*Decision making and branching


A diamond shape is used to show decision making or branching it is also attached with arrows, a decision asks a question. The answer to the question determines which arrow you follow.


*Flow line


Arrows show the flow line on a flowchart, they lead you to all the steps of the procedure shown on the chart.










3. How many lines may enter a decision symbol and a process symbol?


When using a decision symbol two to three lines should be used, when using a process symbol only one line should come out of the process symbols.