Grade 7
UNIT 5
PROGRAMME
DEVELOPMENT
D Learning Academy by Deshani Jayasuriya
Copyright © by D Learning Academy – Deshani Jayasuriya
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form
or by any means, including photocopying, recording, or other electronic or mechanical methods, without
the prior written permission of the publisher, except in the case of brief quotations embodied in critical
reviews and certain other noncommercial uses permitted by copyright law.
D Learning Academy Grade 7
CONTENT
IN THIS SECTION:
This chapter will cover the following:
• Multi-condition selection control
structures
• Use of flowcharts to solve
problems with many conditions
• Repetition control structures
• Use of flow charts to solve
problems with repetition
procedures
• Development of Scratch program
using selection and repetition
control structures
• Solutions with flow charts having
nested loops
D Learning Academy by Deshani Jayasuriya
D Learning Academy Grade 7
Decomposing the Problems
• A problem can be simple or complex according to its nature.
• It is rather difficult to perceive and understand a complex problem when compared with a simple problem. It is
essential to understand a problem thoroughly before going to solve it.
• So it will be easier to find a solution to a complex problem after decomposing it into smaller sub-problems.
Basic mathematical function which include addition, subtraction, multiplication and division of a whole number.
Flow Charts present the steps of an algorithm graphically. The following standard symbols use to draw flow charts.
Symbol Name Symbol Function
Oval Use to present the Start & End
Parallelogram Use to present the Input & Output
Rectangle Use to present the Process
Diamond Use to make a Decision.
Arrows Use to present the Data Flows.
Circle Use to connect Data Flows.
D Learning Academy Grade 7
Algorithm
An algorithm may include one or more control structures out of three. Three types of control structures are shown below.
Sequence
If the steps from the beginning to the end of an algorithm are carried out in a strict order, it is called a sequence.
D Learning Academy Grade 7
Simple Selection
Simple selection is selecting one option out of two given options under a certain condition. For example, one such choice
is the selection of “head” or “tail” with the toss of a coin.
D Learning Academy Grade 7
Simple selection has one condition with two options. A selection is made out of the two conditions. If the condition is
true, one option is selected and if not, the other option gets selected.
Selection out of many options
Selection out of many options is about selecting one out of more than two options.
D Learning Academy Grade 7
Scratch repetition control structures
• A repetition will take place depending on whether a condition is satisfied or not satisfied.
• Execution of an instruction or several instructions in an algorithm repeatedly until a condition is satisfied is
called repetition.
• Three repetition control structures are available to build Scratch programming. They are shown below;
• Since your childhood, you used to save money by using a till to put money.
• The one who is used to save money in a till, will always put money (again and again) repeatedly until the till fills.
So, here the process of putting money is repeated until the condition that is ‘till becomes full’ is satisfied.
Checking of condition for repetition can take place in two ways.
1. Check the condition before repetition starts.
2. Check the condition after functioning once.
D Learning Academy Grade 7
Ask for input with ‘What’s the number?’
If even number, output should be ‘number is an even number’ if answer <30
Forever Loop Example:-
D Learning Academy Grade 7
Programming with problem analysis
Output is ‘What is the value?’, if answer equals 1,2,3,4,5, or 6. Sprite will say the value
If the number is less than 5, say the number, repeat it five times
D Learning Academy Grade 7
If the remainder is 0 when mod is used, its an even number
Make Sassy and Ballerina Dance
D Learning Academy Grade 7
Version - Scratch 2.0 Version - Scratch 3.0
Exercises
1.Name 2 control structures
2. How can you move the sprites?
3. How do you broadcast messages?
4. Which function is used to add voice to sprite?
5. Which function is used to change backdrop?
6. Design the following develop program on Scratch
Ask for the day of the week and decide if it’s a weekday or weekend and do the assigned work
What is the day of the week?
If a weekday (Monday, Tuesday, Wednesday, Thursday, Friday) -> Go to School
If a weekend (Saturday, Sunday) -> Do your homework and have fun
7.Write the relevant input output, process to get the sum of two numbers, multiply the two numbers and
draw the flow chart and develop program on Scratch
• Input-……………………………………………………………………………………………………………
• Output-…………………………………………………………………………………………………………
• Process-…………………………………………………………………………………………………………
D Learning Academy Grade 7
8. What is an algorithm?
...................................................................................................................................................................
.................................................................................................................................................................
9. What is a flow chart?
……………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………
10. Name the following codes used for flow charts.
D Learning Academy Grade 7