Monday, September 10, 2012

Selection and Repetition


Selection and Repetition


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.
2.    Deciding whether to take an umbrella to school.
3.    Giving a student an A, B or C on their test.

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.
2.    Filling a bucket with water.
3.    Blowing up a balloon.

Remember to post all this in your blog along with any useful links you find in the process.

Monday, July 16, 2012

Flowchart symbols and logic

FLOWCHART BASICS

The site below is excellent for understanding flowchart symbols and logic. (This will be an excellent resource for developing the flowchart required in the assessment!). For today read through the tutorial and post about the following.


1. What is a flow chart? 
Is a means of visually displaying the flow of data 

2. Describe the basic flowchart symbols for: 
  • Start or end of the program:

  • Computational steps of processing function of a program:
  • Input or output operation:
  • Decision making and branching: 
  • Flow line:

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.

Only one flow line should enter and exit from a process symbol 


Only one flow line should enter a decision symbol, but two or three flow lines (one for each possible answer) should leave the decision 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.



What is an Algorithm


Algorithms

What is an Algorithm?

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

For 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.

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"?)
·        It is in the correct sequence.
·        Is very specific to the task at hand.

2.      Define Algorithms for the following processes.

Posting a letter:
1. write the letter on piece of paper.
2. put letter into the envelope.
3. seal envelope
4. write the address of the person you are sending the letter to on the front 
5. stick stamp onto the right top hand corner of envelope
6. write your address onto the back of the envelope
7. walk to post office or post box
8. drop letter into the post office /post box 

Making Toast: 
1. get bread
2. go to toaster 
3. put bread into toaster
4. press leaver on toaster to push toast down
5. wait 2-3 minutes until toast pops up again 
6. take bread out of toaster
7. put desired topping onto toast 

Calling a friend on the cordless land line phone: 
1. Pick up the phone 
2. Dial the number into the phone 
3. Press the green call button
4. Wait for call to connect and the person to pick up 
5. If person doesn't answer the phone repeat steps 1-4 if person doesn't answer
6. Talk to the person

Term 3

Today is the first lesson of term 3.

Monday, June 18, 2012

Javascript Tutorial


1.     What is Java script?
A scripting programming language most commonly used to add interactive features to webpages.

2.     What is Object Oriented Programming (OOP)?
Creating a program that can use and support objects (data structures)

3.     What three components make up OOP?
Model: the data
View: visual representation of the data
Controller: the interface between the view and model

4.     Give an example of an object, a method and an event.

5.     Where is Java script placed in a html page?
It can either be placed at the head of the document (between the <head> and </head> tags) or in the body (between <body> and </body> )

6.     What four lines of code indicate the beginning and end of java script?

7.     What do java script forms do? Name two objects that could be included in a form.

8.     What four attributes does a java script button have?

Alter a basic HTML page to contain the code used in chapter 1 of this tutorial as well as display a clock as coded by the java script in the link below.


Data compression involves reducing file size by either discarding unnecessary data or by use of algorithms that look for repeating patterns in data (redundancy).

Visit the sites below then answer the following questions;



  1. Name two programs used for file compression.
    -Winzip
    -WinAce

  2. What name is given to the file compression method that looks for redundant patterns?
    Lossless Data. This is when the original data is reconstructed to make it more easily compressed.
    Why can’t music be compressed efficiently with this type of  compression technique?
    Because music often don’t repeat as many text files as text files.

  3. What method of compression is most suited to graphics and music files?
    Lossy compression. This is when data is compressed by getting rid of (losing) bits of data. This reduces the amount of data that needs to be held. It is most suited to graphics and music files as it eliminates bits of sound not heard by the humar ear in music files, and gets rid of pixels in an image.

 Use Gimp (Start > Programs > Gimp2) to open an image and then save it as a jpeg with different levels of compression. Paste these images below. Explain why the appearance of the images varies!!


Uncompressed (108.5)




 






Low Compression (9.37 KB)  
Medium Compression (4.82KB)
 High Compression (1.14KB)
The images appear different because each time the image is compressed bits of information (pixels) are taken out of the picture. At a low compression our brains fill in the gaps of the missing pixels, but as more pixels are removed, our brain finds it harder to fill in the missing pixels.












 

Basic HTML and Basic HTML 2


There are many online tutorials on using HTML. The link below is to an excellent site that steps you through creating a basic page.


Work through the first four pages – Home, Introductions, Elements, Basic Tags.

Use the tutorial and NOTEPAD to create a page displaying the following elements;

  • Headings
<h1>Headings</h1>

  • Background colours
<body style-“background-colour-blue”>

  • Paragraph break
<p>paragraph</p>
<p>second paragraph</p>

  • Line break
<p>paragraph<br/> with multiple <br/> line <br/> breaks

  • Bold font
<b>

  • Comments
    <!—Comments-->

  • Image as a background
    body
    (
    background-image: url(‘name of image.gif’);
    )

  • A hyperlink to the first page
    <a href= “url”>Link text</a>

  • An image
    <img src=“source of the image” alt “alternative text for the image”>

  • Image as a hyperlink
    <a href= “url’>
    <img src= “image source.gif” alt= “alternative text”

Coloured Fonts
<h style=font-family:verdana;colour;red;”>Heading</h>

<p style=font-family:times;colour;blue”>Pararaph</p>