Sadržaj

Main page, Previous page

Programming primer

INPUT

<font 14px/inherit;;inherit;;inherit> Topic: How the data enter in computer? </font>

<font 14px/inherit;;inherit;;inherit> 5 and 6 period </font>

<font 14px/inherit;;inherit;;inherit>Comment for the teacher: The assignments are done in two steps. The first step is that children read aloud the questions, and in second step they solve the assignment using their Memas.</font>

<font 14px/inherit;;inherit;;inherit>The children have in front of them their Memas and a handful of beans or other grains of similar size.</font>

<font 14px/inherit;;inherit;;inherit>Questions and assignments:</font>

  1. <font 14px/inherit;;inherit;;inherit>Put 5 grains in the blue drawer.</font>
  2. <font 14px/inherit;;inherit;;inherit>Put as many grains you wont in the red drawer.</font>
  3. <font 14px/inherit;;inherit;;inherit>Put in the green drawer less than five grains.</font>
  4. <font 14px/inherit;;inherit;;inherit>How many grains do you have in the blue drawer? (correct answer is 5)</font>
  5. <font 14px/inherit;;inherit;;inherit>How many grains are in the red drawer? (Check the child's Mema for the correct answer.)</font>
  6. <font 14px/inherit;;inherit;;inherit>How many grains are in the green drawer? ( Answer may be 1, 2, 3, or 4, but empty drawer means zero grains, so this is as well one of correct answers.)</font>
  7. <font 14px/inherit;;inherit;;inherit>Put as many grains you can get in the yellow drawer. How many grains do you have? (It will depend of the size of grains: so we encountered one more property depending ob hardware cold field capacity . (The answer can be checked on student's Mema and the teacher may mention that the real computer have some limitation about the size of numbers they can use.)</font>
  8. <font 14px/inherit;;inherit;;inherit>Put in all drawers the same number of grains. Does the blue drawer contain more grains than the red one? (No, the number of grains is same.) Does the yellow drawer contain more grains than blue and res together? (No)</font>
  9. <font 14px/inherit;;inherit;;inherit>Comment for the teacher: the drawers may contain some grain before an instruction which ask to put a number of grains in this drawer. In this case the drawer has to be emptied before putting the new content. This is exactly what the real computer does, clear the old contents before putting the new one.</font>
  10. <font 14px/inherit;;inherit;;inherit>Put one grain in every drawer. How many grains are in all drawers together? (correct answer is 9)</font>

<font 14px/inherit;;inherit;;inherit>Empty all drawers. How many grains are in all drawers together? (correct answer is zero or none.)</font>

<font 14px/inherit;;inherit;;inherit>Instead by words we can give the instructions for working with Mema by drawing.</font>

<font 14px/inherit;;inherit;;inherit> Comment for the teacher: </font>

<font 14px/inherit;;inherit;;inherit> Example: An instruction given by drawing </font>

blue.jpg

<font 14px/inherit;;inherit;;inherit> This instruction means: Put as many grains you wont in the blue drawer. </font>

<font 14px/inherit;;inherit;;inherit> Question: Say what does this instruction do?</font>

green.jpg

<font 14px/inherit;;inherit;;inherit> Answer: This instruction require to put a number of grains we wont in the green drawer, In other words this instruction requires input of data in the green drawer. </font>

<font 14px/inherit;;inherit;;inherit> Assignment: Draw the instruction which requires to put as many grains you want in the red drawer.</font>

<font 14px/inherit;;inherit;;inherit> Answer: </font>

red.jpg

<font 14px/inherit;;inherit;;inherit> Assignment: Draw the instruction which requires to put as many grains you want in the blue drawer, as many grains you want in the red drawer (same or different number), as many grains you want in the green drawer and as many grains you want in the yellow drawer.</font>

<font 14px/inherit;;inherit;;inherit> Answer: </font>

input_slika1.jpg

Emphasize:
There we have a sequence of many instruction, and we can call it a PROGRAM.

<font 14px/inherit;;inherit;;inherit> Assignment: (Having reference to previous picture) Execute the program using 7,8,1 and 5 as inputs.</font>

<font 14px/inherit;;inherit;;inherit> Solution: The input in the blue drawer is 7 grains,in the red drawer is 8 grains, in the green is one grain and in the yellow drawer is 5 grains.</font>

<font 14px/inherit;;inherit;;inherit> Question : Way the contents of red should be 8?</font>

<font 14px/inherit;;inherit;;inherit> Question : Could we say: Execute this program with 7, 8, 1 and 5 as inputs.</font>

<font 14px/inherit;;inherit;;inherit>Answer: Yes, we could. And the solution would be the same as before.</font>

<font 14px/inherit;;inherit;;inherit> Assignment: Execute the same program with 5, 6, 2 and 4 as inputs.</font>

input_slika2.jpg

Problem:
The drawers we use are not empty.
We have to put 5 grains in the blue drawer, and we have already some grains in this drawer.

<font 14px/arial,sans-serif;;inherit;;inherit>Solution</font> : <font inherit/arial,sans-serif;;inherit;;inherit>The blue drawer has to be emptied before putting 5 grains in it.</font>

<font 14px/arial,sans-serif;;inherit;;inherit>Discus this problem with children.</font>

Comment:
This introduce one of the basic facts concerning programming:
//the new contents replace the old one.//

<font 14px/arial,sans-serif;;inherit;;inherit> Assignment: </font> <font inherit/arial,sans-serif;;inherit;;inherit>Execute this program:</font>

input_slika1.jpg

<font 14px/arial,sans-serif;;inherit;;inherit> Advice: </font>

OUTPUT

<font 14px/arial,sans-serif;;#000000;;inherit>Clicking the link</font> OUTPUT <font 14px/arial,sans-serif;;#000000;;inherit>you</font> <font 14px/arial,sans-serif;;#000000;;inherit>can go to the next lesson.·</font>