Monday, July 25, 2011

PROGAMMING RESOURCES

This is a research task and we are allowed to do it in groups. I am working with Sangeeta Raja and we are currently deciding on the topics we must do. Here are some that we are interested in:

Error detection
• syntax
• logical
• run-time

Flowcharting
• symbols
• samples using selection and repetition

Control structures
• sequencing
• selection such as binary and case
• repetition and/or iteration such as pre and post test

After much thoughtful consideration, we finally chose to research error detection because it was a new area that we have not expkored yet and it sounded quite interesting. We have alerady done flowcharts and touched on control strucuters, therefore it was appropriate for us to choose this topic.




Selection and Repition

As we have mentioned in previous lessons Algorithms are composed of three basic structures. Sequence, Selection and Repetition.
We have already looked at sequence (the single steps in the algorithms we did before are sequence) so what are selection and repetition.
Solving a problem often involves making a decision between two or more options. In an algorithm this process of making a decision is called selection.

Describe, in plain english, an algorithm for;

(you may need to research algorithms in google.

Use the word “if” ie If red then ……)
1. Moving through a set of traffic lights.

1. Approach the traffic lights
If lights are red, stop
If lights are green, proceed
If lights are amber, slow down

2. Deciding whether to take an umbrella to school.

1. Approach the umberlla
If it is raining, take an umberella
If it is not raining dont take an umberella

3. Giving a student an A, B or C on their test.

1. Look at the students' marks
If the student receives over 95%, give them an A
If the student receives over 80, give them an B

If the student receives over 60, give them an C


Often an algorithm will often require you to repeat a task in order to solve a problem; when this is done in an algorithm the structure is called repetition.

Describe, in plain english, an algorithm for;
1. Adding the correct amount of cordial to water to make a drink.

1. Fill a quarter of a glass with coridal
2. Fill three-quarters of the glass with water
3. Repeat steps 1 and 2 for more cordial

2. Filling a bucket with water.

1. Get a mug
2. Fill it up with water
3. pour it into the bucket
4. Repeat steps 1, 2, and 3 until the bucket is full

3. Blowing up a balloon.

1. Get a balloon and a balloon pump
2.  Put the mouth of the balloon into the pump nozzle
3. Push the pump in and out
4. Repeat the 3rd step until the balloon is filled with air.


Thursday, July 21, 2011

ALGORITHMS

An algorithm is an unambiguous set of steps, which when performed correctly by a processor, will result in a process being carried out in a finite time.

 
EXAMPLE: if you were to explain to someone how to make a cup of coffee you would be defining an algorithm; 

 

 
1. boil the water,
2. place coffee in the cup,
3. place sugar in the cup,
4. add the boiling water,
5. add milk,
6. stir.

 

 
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"?)

 
  • The first property that is vital in an algorithm is that the processes are in order. Any change of order will alter the ultimate outcome. Suppose you swapped step 6 and step 2, the algorithm would look like this:
1. boil the water,
6. stir.
3. place sugar in the cup,
4. add the boiling water,
5. add milk,
2. place coffee in the cup
 
Here you would actually be stirring nothing in the second step and placing coffee in cup at the end. Therefore the steps and their order are essential to an algorithm.
  • The scond property, i believe, is that they have to conscie, clear and to the point. Too many complicated words will not only complicate your task but also the readers or the information process system.

 
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
4. Call



 
 

 

 

 

 
 

Tuesday, July 19, 2011

Flowchart Symbols and Logic

1. What is a flowchart?
It is a method of illustrating the:
  •  Flow of data through an information processing system
  • The functionings within the system and
  • Their sequence of their performance
2. Basic flowchart symbols :


3. With the decision making symbol (diamond) and the process symbol (rectangle), what are the rules for how many lines may enter and leave the symbol.




4. Study the sample flowcharts then create a flowchart for a coin toss where heads means Mary pays for the pizza and Tales means Bill pays.



STORYBOARD

This was my rough story board that i used to base my website on :

Click on it for a better view :)