0% found this document useful (0 votes)
8 views3 pages

Task 1: Create A Storage Calculator in Scratch: Year 8, Unit 2, Lesson 2, Worksheet 1

Uploaded by

molaposk10
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)
8 views3 pages

Task 1: Create A Storage Calculator in Scratch: Year 8, Unit 2, Lesson 2, Worksheet 1

Uploaded by

molaposk10
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/ 3

Task 1: Create a storage calculator in Scratch

Let’s make a calculator to see how many kibibytes, mebibytes and gibibytes are used for
different files.
The calculator needs to ask the user ‘What is the file size in bytes?’
The calculator will then need to do a division to work out how many KiB are being used to
store the file size entered in bytes.
The calculator will need to use a variable to store the answer of the division.
To work out how many kibibytes are in the file you will need to use the following code:

Use this code to convert bytes to KiB. When you have done this can you make the code to
convert the bytes to MiB and GiB.

What to do:

1) Open Scratch
2) Find the variable blocks.
a. Create a new variable called ‘FileSizeKibibytes’
b. Drag the ‘set FileSizeKibibyte to__’ block onto the working area
c. Drag the ‘show variable FileSizeKibibyte’ block onto the work area.

3) Find the operator’s blocks.


a. Drag the ‘ _ / _’ block onto the work area.

4) Find the sensing blocks.


a. Drag the ‘ask____ and wait’ block onto the work area.
b. Type into the block the question you would like to ask, e.g. ‘What is the file
size in bytes’.
c. Drag the ‘answer’ block onto the work area’

Year 8, Unit 2, Lesson 2, Worksheet 1


© Pearson Education Ltd 2019. Copying permitted for purchasing institution only. This material is not
copyright free. Scratch is used with the kind permission of MIT media labs. Scratch is not affiliated with
Pearson Education in any way
5) Arrange all of the blocks to look like this:

6) Change the 0 to be 1024 because that is how many bytes are in a kibibyte. Now you
can convert from bytes to kibibytes.

7) Add the variables you will need for gibibytes and mebibytes:
a. FileSizeMebibytes
b. FileSizeKibibytes

Use the following blocks to create the code to change from bytes to mebibytes:

Now you can create the code to change from bytes to gibibytes using new blocks.

Year 8, Unit 2, Lesson 2, Worksheet 1


© Pearson Education Ltd 2019. Copying permitted for purchasing institution only. This material is not
copyright free. Scratch is used with the kind permission of MIT media labs. Scratch is not affiliated with
Pearson Education in any way
Task 2: Complete the table using your Scratch calculator

File Size in bytes Size in Size in Size in


kibibytes mebibytes gibibytes

document 5 242 880

photo 20 971 520

sound file 786 432 000

email 4 324 232

vector image 10 723 550

Year 8, Unit 2, Lesson 2, Worksheet 1


© Pearson Education Ltd 2019. Copying permitted for purchasing institution only. This material is not
copyright free. Scratch is used with the kind permission of MIT media labs. Scratch is not affiliated with
Pearson Education in any way

You might also like