►[[:en:start|Main page]], [[:en:mema|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: - Put 5 grains in the blue drawer. - Put as many grains you wont in the red drawer. - Put in the green drawer less than five grains. - How many grains do you have in the blue drawer? (correct answer is 5) - How many grains are in the red drawer? (Check the child's Mema for the correct answer.) - 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.) - 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.) - 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) - 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. - 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 ** {{:en: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? {{:en: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: // {{:en: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: // {{:en:input_slika1.jpg?nolink&}} 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. {{:en: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: [[:wiki:plavo_crveno_zeleno_zuto.png?289x275}}|{{:en:input_slika1.jpg?nolink&273x244}}]] ** 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 [[:en:izlaz|OUTPUT]] you can go to the next lesson.·