• ### UNIT 7:PROGRAMMING FOR CHILDREN

Introduction

You are growing up in a digital world where everything involves use of electronic devices. These devices operate using stored programmes.

Look at the following screenshots.

Describe each screenshot above.
Predict what you are going to learn.

Turtle Art Activity

7.1 Drawing geometric shapes

Activity 7.1: Identifying geometric shapes

(i) Draw the following pictures in your notebook.
(a) Parallelogram           (b) Rectangle
(c) Trapeziums               (d) Rhombuses

(ii) Identify the following regular polygons.

(iii) Study the following table correctly.

Copy the table in your notebook and fill in appropriately. Use the Browse Activity on your XO laptop to find out more information.

Drawing a 6 sided polygon in Turtle Art

Activity 7.2: Drawing hexagon in Turtle Art

Use the Forward Command and Left/Right command. Using the Forward and Right/Left commands to draw a 6 sided polygon you can also use the Repeat command.
(i) Select the instruction block written on Forward. Enter the number of pixels that you want your Turtle to move e.g. 200.
(ii) Select the Left or Right command. Enter the angle as 60°.
(iii) Enter the two steps above 6 times.

(iv) Run your stack slowly to see how your Turtle draws the polygon.

Using the Repeat command

The repeat command helps you to avoid writing the same commands several times.
When you use the Repeat command you should also use the command written on Start.

Parallelogram

Activity 7.3: Drawing a parallelogram in Turtle Art

Draw a parallelogram using Turtle Art instructions.
(i) Select the Left or Right command block. Enter the angle as 105°.

(ii) Select Forward command block. Enter the number of pixels that you want your Turtle to move e.g. 200.
(iv) Select the Left or Right command block. Enter the angle as 75° (180– 105).
(v) Select the Forward command block and enter the pixels as 100.
(vi) Repeat the above instructions one more time.

A parallelogram is a slanted rectangle. Two of its opposite sides are parallel to each other. Opposite angles are also equal.

Rhombus

Activity 7.4: Drawing a rhombus in Turtle Art

(i) Access the Turtle Art Activity. Using the instructions you used in drawing a parallelogram, draw a rhombus.
Hint: Use the same pixel values for all your Forward commands.
(ii) Draw rhombuses of various sizes using Turtle Art Commands. Practice using the Repeat command to draw your rhombus.
(iii) Calculate the perimeter and area of the figures in your Notebooks.
(iv) Give your book to the teacher for marking.

A rhombus is a slanted square. It has 4 equal sides. The opposite angles in a rhombus are equal.

Trapezium

Activity 7.5: Drawing a trapezium in Turtle Art

(i) Draw a trapezium in Turtle Activity.
(ii) Draw the trapezium that the Turtle draws in your book.
(ii) Practise drawing another trapezium that has a different shape.

What to do:

1. Drop the stack of command blocks shown in the screenshot opposite.
2. Run the stack of commands to obtain your Trapezium.

7.2: Arithmetic Operations

Practice Activity 7.1

(i) Work out the following in your notebook
(a) 3 + 2             (b) 7 × 3           (c) 36 ÷ 9          (d) 60 – 7
(ii) Comment about the activities in (i) above.

Arithmetic deals with counting and calculations of numerical data.
Turtle Art has a Number palette that contains operators that are useful in carrying out mathematical calculations. The Number palette appears on fig. 7.7:

When you click on this palette, several operations are displayed as shown below.

The icons labelled 1, 2, 3 and 4 are, addition, subtraction, multiplication and division blocks respectively. Icon 5 is the number block.

You use the Addition operation and the Number block to add two numbers. The Addition operation is represented by the symbol +.

Example:
Gilian had 100 bulls, she bought 300 hundred cows.
How many cattle did she have all together?

Subtraction

Use the Subtraction operation and the Number block to add two numbers.
The Subtraction operation is represented by the symbol –.

Example:
Peter had 10 pencils. He gave 3 pencils to his sister. How many pencils was he left with?

Multiplication

Use the Multiplication operation and the Number block to multiply two numbers.
The Multiplication operation is represented by the cross symbol X.

Fig. 7.10: Multiplication operation.

Example:

A plot has 5 rows of tomatoes. Each row has 10 tomato plants. How many tomato plants are in the plot?

Fig. 7.11: Multiplying two numbers.

Division

Use the Division operation and the Number block to divide two numbers.
The Division operation is represented by the symbol /.

Fig. 7.12: Division operation.

Example:

Mrs Gatere has 30 books. She wants to share the books equally among her 5
children. How many books will each child get?

Fig. 7.13: Dividing two numbers.

Practice Activity 7.2 Performing Calculations

Use the Arithmetic Operations in your XO’s Turtle Art Activity to solve the following problems:
1. Use the following picture to answer questions that follow (distance between Kigali and Muhanga = 50 km, Kigali and Ngororero = 88 km.

(a) Anne has cycled from Kigali to Muhanga. How many kilometres does she need to cover in               order to reach Ngororero? Show your calculations using the Turtle Art Activity.
(b) Moses cycled from Kigali to Muhanga in 10 days. How many kilometres did he cover each               day?      Use the Turtle Art Activity to do your calculations.
2. Find the area of a parallelogram with a length of 10 cm and a width of 6 cm.

3. (a) Use the Turtle Art Activity to draw the figure that the command blocks below will give.

(b) Calculate the area of the figure.
4. James had 27 mangoes. He shared the mangoes equally between his three friends. Use the          Turtle Art activity to calculate the number of mangoes that each of James’ friends got.

Scratch Activity

7.3 Create dialogue and cartoons

Activity 7.7: Changing the appearance of a Sprite

(i) Click on the Costumes icon in the script pane.

(ii) You will get three options; Paint, Import and Camera. These three are the ones used to change the sprite's appearance.
(iii) What happens when you click on the Edit or copy icons?

Dialogue and cartoons can be created as Scratch projects in the Scratch Activity.

These projects can then be shared among Scratch Activity users.

Spriting
Sprites are the objects that perform actions in dialogues and cartoons (actors).
Sprites are important because they are the ones that move and act.
Spriting is the act of creating or modifying objects that act for use in dialogues and Cartoons.

Paint Option
The Paint Option gives you a background with tools that allow you to draw and paint sprites of your own choice.

Fig. 7.14: Paint Option.

Import option

This option allows you to choose a different sprite from the existing one.

Fig. 7.15: Import Option.

The sprites are grouped in different categories. Each category contains a number of sprites that you can choose from.

Camera

The camera lets you take photographs of objects that you want to use in your project.

When you click on the Camera icon the camera on your XO is activated. You can then take a photograph by clicking on the camera icon, followed by Done.

Commands and speeches

Activity 7.7: Scratch commands

(i) Name the eight command blocks found in the Scratch command palette.
(ii) What are the functions of the pen, sensing, operator and variables command blocks? Give answer basing on your exploration on the XO laptop.

To create dialogues and speeches, you have to create a good script for your sprites to act.
As learnt earlier in P4, there are eight command blocks.
The following blocks will help you to assemble a working script. Such a script will enable you create a dialogue or cartoon.

Motion blocks
• They are blue coloured blocks.
• These blocks make your sprite move, point in a certain direction and change direction.

Looks blocks
• These are purple coloured blocks.
and also change the size of your sprite.

Sound blocks
• These blocks allow you to put sound in your dialogue. The sound can be heard when the project runs.
• It can also be used to stop playing sounds, increase or decrease the volume of sound.

Control blocks
• Instructions in this command block enable your scripts to run.
• These instructions help you to run scripts for each sprite, repeat instructions, wait or give directions to sprites.

7.4 Organization

Activity 7.8: Organizing a script

(i) Research the following topics: corruption, child abuse, drugs, health, sports and environment.
(ii) Following the example create dialogues about these topics.
(iii) Create the scripts of one dialogue.
(iv) Organise the commands to create a functional script in the script pane.

A script is created by grouping commands that convey certain information together.
When the command blocks are stacked and the green flag in the stage pane clicked, your cartoon or dialogue will be acted.
The following script gives a game dialogue between Irene and Jane.

Fig 7.18: Examples of organized scripts

After creating your script above. Click the green flag in the stage pane to see what happens.

Background setting

Activity 7.9: Using background settings

(i) Click on the Stage icon in the thumbnails pane.
(ii) Practise using paint, import and camera options.

When you click on the Stage icon, Pop up menus appear in the script pane.
These are backgrounds and sounds.
When you click on Backgrounds, the following menu comes up.

Paint option
The paint option gives a paint palette similar to that used in creating new sprites.
(Refer to Fig. 7.14 on page 74)
Import option
This option gives you lots of backgrounds that you can choose from. You can also select images that are stored on your computer.

Camera option

The camera option lets you take photographs of objects that you want to use for the background of your Scratch stage.

Practice Activity 7.3 Changing backgrounds choosing sprites and inserting sound in project work

1. Look at the following figure. What photograph has been used as the stage’s background?

2. Practise taking photographs of various backgrounds using your XO Laptop.
3. Change the sprite shown in the above figure to that of a bee.
4. Sounds is an Icon that appears both in Sprinting and Background setting. Find out practically           how sound setting is done using Set and Import options.
6. (a) Press the icon written on outdoors. Write down the outdoor backgrounds there.
(b) Click on the Nature icon. Choose flower-bed background and click okay.

Revision Activity 7

1. When you drag and drop the forward block to start drawing your shape, the turtle will .
A. move one step back wards
B. move one step right
C. move one step left
D. move one step forward

2. (a) What is the name given to the image shown here?
A. Tool bar
B. Palette

C. Main Area
D. Stage

b) The space marked p below is known as

A. Tool bar         B. Palette           C. Stage             D. Main Area
3. (a) Which activity is represented by the image below?

(b) List the mathematical operations that can be done using the number palette.

4. Use Turtle Art to draw the following Shapes.
A. Parallelogram
B. Rhombus
C. Trapezium
D. Regular Polygons
5. (a) When scratch activity opens up it will show your sprite. The place where the sprite appears is           called .
A. the stage                   B. the Window
C. command tab            D. dialogue box

(b) What is the name given to images shown below?

A. Files                   B. Folders
C. Documents        D. Tables

6. What is the name given to the process of sending files from an external source to your program?
A. Sourcing
B. Exporting
C. Importing
D. Extracting

7. (a) What is a script?
(b) Create a simple script on your XO laptop.
8. (a) What is a background as used in Scratch Activity?
(b) The following sprites were created by Loice. How did she create them?

(c) Create the sprites shown above.
9. (a) Choose the sprite of a girl from existing sprites.
(b) Change your existing background into background of a bedroom.
(c) Change your background to that of a kitchen

10. You are required to use your own image saved in an external storage device as your new                 sprite. Perform this activity step by step.
11. Explain the following words as used in sound settings.

(a) Sound Editor             (b) Edit tab
(c) Effects tab                 (d) Play Sound

• Stop All Sounds

Word list

1. Read the following words in pairs.
• Turtle Art                                    • Window                               • Button
• Instruction Blocks                       • Sequencing                        • Command Blocks
• Number Palette                          • Operators                           • Explore
• Parallel                                       • Scratch Activity                  • Sprite
• Script Pane                                • Costume Icon                     • Background
• Cartoon                                      • Camera Icon                      • Convey
• Dialogue                                     • Paint Option                      • Import
• Stage Pane                                • Stage Icon                         • Menu

• Costume

2. Spell 3 words while your friend writes them in his or her notebook. Let your friend also spell 3           other words as you write them in your notebook.
3. Discuss with your friend the meaning of any 3 words in the word list.
Refer to notes in your textbook.

UNIT 6:COMPUTER RESEARCHUNIT 8:WATER