P1 WEEK 3 M3 - INFORMATIE TECHNOLOGIE

Week 3 lesson 1
1 / 53
next
Slide 1: Slide
InformaticaMiddelbare schoolhavoLeerjaar 4

This lesson contains 53 slides, with interactive quizzes and text slides.

time-iconLesson duration is: 90 min

Items in this lesson

Week 3 lesson 1

Slide 1 - Slide

Startklaar zitten.
STARTKLAAR!
Tellie in zakkie

Slide 2 - Slide

Startklaar zitten.
Activate prior knowledge

Slide 3 - Slide

This item has no instructions

What is a programming language?
A
A language for instructing computers.
B
A language to sing.
C
A language for cooking.
D
A language to talk to friends.

Slide 4 - Quiz

This item has no instructions

Lets Play ! 

Slide 5 - Slide

This item has no instructions

What is a Variable?
A variable is like a container that stores information in a program.
You can name it and put different types of data inside (like numbers or text).

Slide 6 - Slide

This item has no instructions

Types of Variables
Numbers: Used to store numerical values (e.g., age = 15).
Text: Used to store words or sentences (e.g., name = "Alice").
Booleans: Used to store true/false values (e.g., isStudent = true).

Slide 7 - Slide

This item has no instructions

Why Use Variables?
Variables make programs flexible by allowing data to change.
Instead of hard-coding information, you can reuse and update variables easily.

Slide 8 - Slide

This item has no instructions

How to Use a Variable

Create a variable: Give it a name and assign a value (e.g., score = 0).
Change its value as needed during the program (e.g., score = 10).

Imagine you have a game and want to keep track of the player’s points:
score = 0 # The game starts, and the player has 0 points
score is the variable. It holds the number of points.

When the player gets more points, we change the variable:
score = score + 10 # The player gets 10 points
Now the score variable is 10.







Slide 9 - Slide

This item has no instructions

LEARNING OBJECTIVES
The student can understand and apply variables in programming using the control structure.

Lets Play ! 


Slide 10 - Slide

This item has no instructions

For the teacher
The student can:
Explain what a variable is and what it is used for in a program.
Recognize and use different types of variables (such as numbers, text, and Booleans) correctly.
Create a variable, assign it a value, and change the value of the variable during program execution.
Understand how variables can help make programs flexible and efficient by storing data that can be used or changed later.

Slide 11 - Slide

This item has no instructions

Data types
In programming we talk about data types for example:
String = "1234567890-=][poiuytreADFGG" for example "Yourname"
Int = 0123456789 for example 85
Boolean = true or false for example True
A boolean should not go together with a string
In the real world we actually also have a kind of data types for example the picture below. It is impossible to be a dog and a bear together because they are built differently


Slide 12 - Slide

This item has no instructions

A variable
A piece of space in the computer's memory that you or the computer can change
below is a variable created with the datatype string
var name = "Elif"
In the memory is the variable name created. In that memory we have stored "Elif"



Slide 13 - Slide

This item has no instructions

A variable
var name
var isTeacher
var age
Change variable

name = "elif"
isTeacher = true
age = 39
Now what are the new values ​​of the variables? Write them down on a piece of paper

Slide 14 - Slide

This item has no instructions

what was your answer

Slide 15 - Mind map

This item has no instructions

A variable
naam
isDocent
leeftijd
Change variable
name = name + "el'if"
age = age + 39
Now what are the new values ​​of the variables?
Write them down on a piece of paper

Slide 16 - Slide

This item has no instructions

what was your answer

Slide 17 - Mind map

This item has no instructions

Creating assignments



Quizlet

https://quizlet.com/324147133/variables-computer-science-flash-cards/

Slide 18 - Slide

This item has no instructions

I now know what a data type is and how to create a variable
Ja
Deels
Nee

Slide 19 - Poll

This item has no instructions

I now know how to use a control structure
Ja
Deels
Nee

Slide 20 - Poll

This item has no instructions

Can you write some examples of data types and tell what data type it is?

Slide 21 - Open question

This item has no instructions

Can you make a variable to store an age. Also use a control structure. if your age is older than 18 then you are allowed to go to the horror movie otherwise not. use console.log to state "yes to horror movie" or "not to horror movie"

Slide 22 - Open question

This item has no instructions

Summary
- Review in class

Slide 23 - Slide

This item has no instructions

Week 3 les 2

Slide 24 - Slide

Startklaar zitten.
STARTKLAAR!
Tellie in zakkie

Slide 25 - Slide

Startklaar zitten.
Voorkennis activeren

Slide 26 - Slide

This item has no instructions

create a variable to store the car color. if the color is white then console.log("2x per week wash ") else console.log("1 x per week wash")

Slide 27 - Open question

This item has no instructions

Learning objectives
The student can use a for loop in a program to perform repetitive tasks.


Slide 28 - Slide

This item has no instructions

For the teacher
The student can:

Explain what a for-loop is and what it is used for in a program.
Write a for-loop to repeat a task multiple times, such as printing a series of numbers or repeating a text.
Understand how the structure of a for-loop works, including the initial value, the condition and the step size (increment).
Apply a for-loop in your own code to solve repetitive tasks, such as iterating through a list or performing a calculation multiple times.

Slide 29 - Slide

This item has no instructions

Instructions to the computer
ga naar https://www.programiz.com/javascript/online-compiler/

type the following over




Slide 30 - Slide

This item has no instructions

Instructions to the computer
Steps to Use on Programiz:

Open the Programiz JavaScript Online Compiler.
Writethe code above into the editor.
Click the "Run" button.
The numbers 1 to 10 will be printed in the output section.

Slide 31 - Slide

This item has no instructions

LOOP
// This program will print the numbers from 1 to 10
console.log("Numbers from 1 to 10:");
for (let i = 1; i <= 10; i++) {
    console.log(i); // Print the value of i in each loop
}
// Explanation:
// 1. 'let i = 1;' starts the loop at 1
// 2. 'i <= 10;' means the loop will run until i is 10
// 3. 'i++' increases the value of i by 1 each time the loop runs



Slide 32 - Slide

This item has no instructions

Explaining the code 

for loop: This loop runs a block of code a specific number of times.

let i = 1: This initializes the loop and sets i to 1.
i <= 10: This is the condition that keeps the loop running as long as i is less than or equal to 10.
i++: After each loop, the value of i increases by 1.
In each iteration, console.log(i) prints the current value of i.


Slide 33 - Slide

This item has no instructions

Print Even Numbers:

Modify the loop to print only even numbers between 1 and 10.


for (let i = 2; i <= 10; i += 2) {
    console.log(i);
}

Slide 34 - Slide

This item has no instructions

Countdown from 10 to 1: Modify the loop to count down from 10 to 1.
for (let i = 10; i >= 1; i--) {
    console.log(i);
}

Slide 35 - Slide

This item has no instructions

We can do this more easily
Answer the following questions and write them down on a piece of paper

What do you notice about the structure of the commands you entered?
Can you recognize a pattern in the code?
Do you think you can automate this process? How would you do that?

Slide 36 - Slide

This item has no instructions

Write your answer below

Slide 37 - Open question

This item has no instructions

Complete the assignment
Look at the assignment in teams

period 1 week 3 assignment 4/6



Slide 38 - Slide

This item has no instructions

Now with a for loop
ga weer naar https://www.programiz.com/javascript/online-compiler/

Delete your old code and rewrite the code below.

Slide 39 - Slide

This item has no instructions

Write a forloop where your name is printed 10 times on the screen?

Slide 40 - Open question

This item has no instructions

Summary
Review in class

Slide 41 - Slide

This item has no instructions

Week 5 
IF & ELSE

Slide 42 - Slide

This item has no instructions

Introduction to JavaScript If-Else Statements
  • JavaScript uses if-else statements to make decisions.
  • These statements allow your code to take different actions based on conditions.
  • We will learn how to check conditions and perform different tasks depending on whether the condition is true or false.
  • Work on https://www.programiz.com/javascript/online-compiler/

Slide 43 - Slide

This item has no instructions

What is a Condition?
  • A condition is a statement that can either be true or false.
  • Example: “If it rains, I will take an umbrella.”
  • In programming, conditions are used to make decisions.

Slide 44 - Slide

This item has no instructions

Basic If Statement

Slide 45 - Slide

This item has no instructions

Slide 46 - Slide

This item has no instructions

Adding an Else Statement

Slide 47 - Slide

This item has no instructions

Slide 48 - Slide

This item has no instructions

Multiple Conditions with Else-If

Slide 49 - Slide

This item has no instructions

Slide 50 - Slide

This item has no instructions

Comparison Operators
== : Equal to
!= : Not equal to
> : Greater than
< : Less than
>= : Greater than or equal to
<= : Less than or equal to

Slide 51 - Slide

This item has no instructions

Comparison Operators
if (x == 10) { ... }
if (y != 5) { ... }

Slide 52 - Slide

This item has no instructions

Recap of If-Else Statements

Use if to check if a condition is true.
Use else to define what happens if the condition is false.
Use else if for multiple conditions.

Slide 53 - Slide

This item has no instructions