Table of Contents

Main page, Previous page

Programming primer

INPUT

Topic: How the data enter in computer?

5 and 6 period

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.

The children have in front of them their Memas and a handful of beans or other grains of similar size.

Questions and assignments:

  1. Put 5 grains in the blue drawer.
  2. Put as many grains you wont in the red drawer.
  3. Put in the green drawer less than five grains.
  4. How many grains do you have in the blue drawer? (correct answer is 5)
  5. How many grains are in the red drawer? (Check the child's Mema for the correct answer.)
  6. 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.)
  7. 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.)
  8. 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)
  9. 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.
  10. Put one grain in every drawer. How many grains are in all drawers together? (correct answer is 9)

Empty all drawers. How many grains are in all drawers together? (correct answer is zero or none.)

Instead by words we can give the instructions for working with Mema by drawing.

Comment for the teacher:

  • For drawing on blackboard or white-board use colored chalks or pens.

Example: An instruction given by drawing

blue.jpg

This instruction means: Put as many grains you wont in the blue drawer.

  • Such an instruction is called INPUT, because it requires to put something in something, or a data in a location, or in our case a number of grains in the blue drawer.

Question: Say what does this instruction do?

green.jpg

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.

Assignment: Draw the instruction which requires to put as many grains you want in the red drawer.

Answer:

red.jpg

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.

  • Comment: In this case we need more than one instruction. Actually, we need four of them.

Answer:

input_slika1.jpg

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

Assignment: (Having reference to previous picture) Execute the program using 7,8,1 and 5 as inputs.

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.

  • The teacher have to check the students' Memas after execution of program.

Question : Way the contents of red should be 8?

  • Answer : Because 8 is the second number in sequence, and the input in red is the second instruction in program.

Question : Could we say: Execute this program with 7, 8, 1 and 5 as inputs.

Answer: Yes, we could. And the solution would be the same as before.

Assignment: Execute the same program with 5, 6, 2 and 4 as inputs.

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.

Solution : The blue drawer has to be emptied before putting 5 grains in it.

Discus this problem with children.

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

Assignment: Execute this program:

input_slika1.jpg

Advice:

  • The instruction require to put into the four drawers as many grains we want.
  • Children write in their notebooks 4 numbers (by their own choice) and then fill the grains in four drawers of their Mema.
  • For instance if somebody wrote 3, 7, 2 and 9 in his or her notebook, then the input in the blue drawer should be 3, in the red 7, in the green 2 and in the yellow drawer 9 grains.
  • Before of filling in the drawers, they have to be emptied.
  • The teacher compare the numbers in notebook with the contents of Mema for every child.

OUTPUT

Clicking the link OUTPUT you can go to the next lesson.·

en/ulaz.txt · Last modified: 2016/02/28 12:42 by sbabic
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0