KEMBAR78
6773b1c71999d - Use of Variables in Scratch | PDF | Scratch (Programming Language) | Computer Science
0% found this document useful (0 votes)
48 views5 pages

6773b1c71999d - Use of Variables in Scratch

The document outlines a series of computer science exercises for 8th-grade students focusing on the use of variables in Scratch programming. It includes tasks such as creating countdown scripts, designing a car speed animation with adjustable variables, and building a simple calculator game. Each exercise provides specific instructions for coding and saving projects in personal folders.

Uploaded by

rahmakarous3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views5 pages

6773b1c71999d - Use of Variables in Scratch

The document outlines a series of computer science exercises for 8th-grade students focusing on the use of variables in Scratch programming. It includes tasks such as creating countdown scripts, designing a car speed animation with adjustable variables, and building a simple calculator game. Each exercise provides specific instructions for coding and saving projects in personal folders.

Uploaded by

rahmakarous3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Computer Science

Level : 8th level


Série : Use of variables in Scratch

-------------------------

Nom du Prof : Olfa CHERIAA BEN SALAH

S
Computer Science
Exercise1 : Finish these scripts to ensure they function correctly.

Descriprtion Script

Used Variables: Time


Function: Make a count
down from 10 to 0

Used Variables: Score


Function: Increase the
score by 5 if the sprite
touches the sprite ba-
nanas then it plays the
sound pop.

Used Variables: n1, n2


Function: The script
compares two random
numbers then says if
the number 1 is bigger
or smaller than the
number 2.

1
Computer Science
Exercise2 : Adjustable variables : Car speed animation.
.Design a Scratch project to discover the adjustable variables.
Project details
-Add one sprite “car” (Paint it if you want or add it from the
Scratch sprites library)
-Design a backdrop as shown in the picture.
Code it:
• Make a new adjustable variable “speed” and choose its
range of values from 10 to 50.
• Add the following code to the car sprite.

• Try to edit the following code by adding only one block and so the car will
always adapt its speed to that chosen in the variable.
Improve it:
• Draw red and green circles as two traffic lights
new sprites.
• When clicking the red circle, the car stops
moving.
• When clicking the green circle, the car starts
moving.
• When clicking the car, it plays the car horn sound

➢ Save your project by name “Car speed” in your personal folder.

2
Computer Science
Exercise3 : Simple calculator game
.
Design a Scratch project to make a simple calculator game.

Project details
➢ Add a Backdrop: Choose a backdrop from your computer's image li-
brary or the Scratch backdrop library.
➢ Add a Sprite: Insert the sprite "Giga".
➢ Create Buttons: Add four buttons to the project and customize them
with the symbols for operations: +, -, ×, and /.

Coding Instructions:
The calculator will work as follows:
1- Ask the user to input the first number (Number 1).
2- Ask the user to input the second number (Number 2).

3
Computer Science

3- Determine and say whether Number 1 is even or odd.


4- Determine and say whether Number 2 is even or odd.
5- Display for 2 seconds the message: Click the sign of the operation you
want to use.

When a button is clicked:


Addition (+): Giga calculates the sum of the two numbers and displays the re-
sult:
The result = [sum]
Subtraction (-): Giga calculates the difference between the two numbers and
displays the result:
The result = [difference]
Multiplication (×): Giga multiplies the two numbers and displays the result:
The result = [product]
Division (/):
If the second number is 0, Giga says for 1 second: Sorry... We can't divide by
zero. It then asks the user to enter a new second number that is not 0.
If the second number is not 0, Giga calculates the quotient and displays the re-
sult:
The result = [quotient]

Save Your Work:


Save your project file in your personal folder with the name "Calculator".

You might also like