Grade-8-4 Lesson

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

1

Umayanga Wijesinghe | ICT


2

➢ What is a problem Analysis

All make decisions on a daily basis.


- What should I have for breakfast?

Where should I go this?


??weekend?

Every time we make a decision. After making this decision, over act on it.Thus,
decision-making is a two-step process.

1. Deciding what to do
2. Taking an Action

Problem analysis is …………………………………………………………………….


…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………

Umayanga Wijesinghe | ICT


3

We can divide the problem into smaller


segments. This will make it easier to solve the
problem.

➢ Problem Analysis Method

To Analys a problem we can classified three components.

1. ………………………………………………………………………………….
2. ………………………………………………………………………………….
3. ………………………………………………………………………………….

Umayanga Wijesinghe | ICT


4

For example,
let us consider an invoice issued by a ABC Bookshop. To calculate the price
(amount) of each item, number of items and unit price are required.

First, we should be identified


Input, Process and Output

Input -

Process -

Output -

Umayanga Wijesinghe | ICT


5

Example 1

Find the cost of purchasing five pens

……………………………………………………………………
……………………………………………………………………
……………………………………………………………………

……………………………………………………………………
……………………………………………………………………
…………………………………………………………………….
…………………………………………………………………….

…………………………………………………………………..
…………………………………………………………………..
…………………………………………………………………...

Umayanga Wijesinghe | ICT


6

➢ What is a control structure?

…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………

❖ There are three type of control structure such as,

1.

2.

3.

Umayanga Wijesinghe | ICT


7

➢ What is a sequence control structure?


………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

Ex – climbing up or down step by step when going on


stairs case

Ex – students’ study from


grade 1 to 11 continuing

Example -

Umayanga Wijesinghe | ICT


8

➢ What is a selection control structure?


………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

Example -

Consider a rainy day,


If it rains students are asked to question?

➢ asked to go to the library?


➢ it does not rain, asked to go to the playground.

Umayanga Wijesinghe | ICT


9

Consider a scenario where 10 marks are awarded to the correct answer

Before marks are awarded, it must be checked whether the answer is correct or
wrong. If the answer is correct, 10 marks are awarded. Incorrect answers are
awarded no marks.

……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….

Umayanga Wijesinghe | ICT


10

➢ What is a repetition control structure?


………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

Ex – a class teacher marking the attendance


register

Umayanga Wijesinghe | ICT


11

➢ What is Flow Chart?

……………………………………………………………………………………
……………………………………………………………………………………
……………………………………………………………………………………
……………………………………………………………………………………
……………………………………………………………………………………

Umayanga Wijesinghe | ICT


12

……………………………………………….

……………………………………………
….
…………………………………………….

Umayanga Wijesinghe | ICT


13

Umayanga Wijesinghe | ICT


14

Umayanga Wijesinghe | ICT


15

Umayanga Wijesinghe | ICT


16

➢ What is a Scratch program and Scratch Interface

SCRATCH is an Open-Source Visual Programming


Language produced to make programming easier to
learn and your own interactive stories animations,
games, music, and art.

Umayanga Wijesinghe | ICT


17

Umayanga Wijesinghe | ICT


18

Scratch components

Umayanga Wijesinghe | ICT


19

➢ We can sprites (cat image) move 10 steps forward using Move –Steps in the Blocks
Palette and dragging it onto the Scripts Area.

Umayanga Wijesinghe | ICT


20

➢ Turn …. Degrees

1. Rotate clockwise 15 degrees 2. Rotate anticlockwise15 degrees

• Sprites

➢ The sprite move by (10) to the right change x by a positive number.

➢ The sprite move by (10) to the right change x by a negative number.

Umayanga Wijesinghe | ICT


21

➢ Control Tools

• When. Clicked
- When the green flag is clicked do the following steps

• Wait..secs - It does nothing for 1 second. Go to the next step after 1 second

➢ Practical Example

Umayanga Wijesinghe | ICT


22

Umayanga Wijesinghe | ICT


23

Variable

➢ What is a variable?

…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………

What is a Variable name?

The names you give to computer memory locations


which are used to store values in a computer program.

Ex - length, width, marks, height, score, count, total

➢ Create Variable in Scratc

- There are two buttons displays in the block Blocks Palette. When clicked on the
variable block, the following image will be shown

Umayanga Wijesinghe | ICT


24

• When clicked Make a variable in the Blocks Palette the following dialog box will be
displayed.

- For all sprites: Create a new variable that all sprites can see (Such as Marks)
- For this sprite only: Creates a new variable that only this sprite can see

Umayanga Wijesinghe | ICT


25

Umayanga Wijesinghe | ICT


26

➢ What is a errors?

…………………………………………………………………...................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................

Type of Errors
• Syntax Error
• Semantic error
• Logical error

• Syntax errors:
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................

• Semantic errors:
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................

• Logical errors:
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................
........................................................................................................................................

Umayanga Wijesinghe | ICT


27

Two types of selection control structures can be used in developing Scratch programs

1. ………………………………………………………
2. ………………………………………………………

Ex -
…………………………………………………………………...................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
…………………………………………………………………...................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................
.......................................................................................................................................

Umayanga Wijesinghe | ICT


28

➢ What is a comparison Block?

.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................

1. Check whether the value on the left is smaller than the value of the right.

2. Check whether the value on the left equals to the right.

3. Check whether the value on the left is greater than the one on the right.

Umayanga Wijesinghe | ICT


29

There are three types of logical blocks as follows

instruction blocks are used to combine comparison


instruction blocks.

The decision is taken after


comparing the two values
instruction blocks.

1. AND

Umayanga Wijesinghe | ICT


30

2. OR

3. NOT

Umayanga Wijesinghe | ICT


31

Umayanga Wijesinghe | ICT

You might also like