+ All Categories
Home > Documents > Variables. Todays Lesson In todays lesson you are going to: Learn to use variables Learn to ask...

Variables. Todays Lesson In todays lesson you are going to: Learn to use variables Learn to ask...

Date post: 05-Jan-2016
Category:
Upload: jeffery-henderson
View: 216 times
Download: 0 times
Share this document with a friend
Popular Tags:
13
Variables
Transcript
Page 1: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Variables

Page 2: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Todays Lesson

In todays lesson you are going to: Learn to use variables Learn to ask for user input Learn to save the users response for use later Use an if else statement to create a quiz Learn to calculate a users score

Page 3: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Variables

A+B=C

If A=1 and B = 2

What is C?

A, B are variables. They can be changed.

Page 4: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Step 1 Getting a user input:

When the user answers their answer is stored by the computer.

You can use this answer in your program.

Can you get the program to ask the users name and then say Hi, <Name>.

Extension: Create a conversation between the computer and the

user.

Page 5: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Task Create a quiz which asks the user a question.

The computer checks this answer is equal to the correct answer,

if it is CORRECT then it will say it is CORRECT

else it will say it is not right.

Use these building blocks to make your quiz.

Page 6: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Scoring the Game

Go to variables

Make a variable called score.

Set score to 0 at the beginning of the game

If the user gets a question right give them 1 extra score.

Page 7: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Experiment Time!

Time to have a play around with scratch!

Page 8: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Lesson 3

In todays lesson we will:

Revise asking for user input Revise variables

Create a program to carry out maths calculations

Create a program to draw a shape based on user input.

Page 9: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Maths Challenge Can you write a program that asks the user for two numbers, adds

them together and displays the result? Ask for a number Create a variable Set the variable to that number

Can you write a program that asks the user for the length of a rectangle and the height and works out the area?

Area of a rectangle is height x length

Can you do the same for Speed

Volume of a cube

Area of a Circle

Find what the formula is online.

Pi = 3.14

Page 10: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Task

You are going to create a program that asks the user to input how many sides they would like their shape to have and then you are going to draw a shape with that many sides.

Page 11: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Angles

There are 360 in a circle.

What angle did you have to turn when you drew a square. What is 90 multiplied by 4?

What angle did you have to turn when you drew your triangle? What is 120 multiplied by 3.

So to figure out what angle to turn you need to divide 360 by how ever many sides you have.

Page 12: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Task Ask how many sides the user wants in their

shape.

If they want 4 sides how often are you going to have to repeat your programme. Think back to when you made your square and triangle.

Add a repeat that will repeat the program as many times as they have said. You will need to drag their answer onto the if.

Page 13: Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.

Get Going Combine these actions to create your programme to draw a

shape.

What do you need to do to get it to actually draw the shape?

Extension: Can you get the sprite to come back to the centre every time the

green flag is pressed?


Recommended