1. Trang chủ
  2. » Giáo án - Bài giảng

3 calculations SCRATCH

14 121 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 14
Dung lượng 327 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Section 3 Calculations National 4/5 Scratch Course... What you should know after this lesson • How scratch stores numbers • How to use variables in calculations • What operators do • The

Trang 1

Section 3 Calculations

National 4/5 Scratch Course

Trang 2

What you should know after this

lesson

• How scratch stores numbers

• How to use variables in calculations

• What operators do

• The importance of sequence in calculations

Trang 3

These are storage locations in RAM, controlled by the programming language

What types of data might we need to use with our programs?

The main ones we will be using are

– Numeric

– String

Trang 4

• Are used for calculations

• If you need to use a piece of data in a

calculation you should use a number variable

Trang 5

Scratch Variables

1 Click on the variables tab

2 Click “Make a variable”

3 Type the name you want

to use for the variable

The scratch language is able to work out the type

of variable we are using and as a result it only has the one type of variable

Trang 6

Displaying Variables

• We can get any sprite to speak by using the say

block from inside looks

• Variables can be displayed on the stage for

example to display information useful to the user

Trang 7

• For this task we are going to add two numbers together

variables called first and second

• Add the script shown below

Copy the program into

your jotter and answer.

1 What does the

program do?

2 Why do we need

First & Second?

Trang 8

Other Operators

• Copy the blocks on the right

into your jotter

• Write beside each one what

it does

• How could we do bigger

calculations?

Trang 9

Combining Operators

• Scratch Operator blocks (

+-*/) can be combined to make

more complex calculations

• Simply drag a block into the

white box

• Remember the BODMAS

rules from maths

• B rackets ()

• O f ^

• D ivision /

• M ultiplication *

• A ddition +

• S ubtraction

Trang 10

• Calculate the

answer to the

following problems,

write the answers in

your jotter (you can

use a calculator)

• Enter the

calculations into

scratch and check

your answers

1 5+4

2 5*4

3 5+4-3

4 34+3*6

5 (34+3)*6

6 40/5 + 4

7 4+40/5

Trang 11

How can we get it to display the full

sum as the answer?

• You can add join to join to make a longer

sentence

• To drag the whole script block drag the

lowermost block

• Edit the program to subtract, multiply & divide Save it in your network area

Trang 12

Assignment of variables

• Variables can be assigned values using the set

block

• Variables can be assigned the results of a

calculation as well as the answer to an ask

block

Trang 13

Review Questions Copy and answer these questions in your jotter

1 Where does scratch store numbers?

2 What is assignment?

3 What do arithmetic operators do?

4 Why is the sequence of calculations important?

Trang 14

Create scratch programs to do the following (save

each in your network area)

1 Calculate the area of a rectangle

2 Calculate the square of a number

3 Calculate the sum of three numbers

4 Calculate the average of three numbers

Ngày đăng: 07/07/2017, 07:26

TỪ KHÓA LIÊN QUAN

w