Professional Documents
Culture Documents
ITE S23-24 Lab4 PartA
ITE S23-24 Lab4 PartA
Spring 2023-24
Lab 4: Visual Programming – Repetition
Objectives: Use loops to repeat blocks multiple times.
LOOPS (Control):
2) forever block: Repeats the blocks over and over until the Stop button is clicked.
Part A
Activity A-1:
PATTERN OF HEXAGONS Video Link
Create a project using the Crystal which will use a Pen to draw a hexagon [side length = 80]
360
A hexagon has 6 sides of equal length with 6 equal angles. Each angle is 60 degrees [ = 60]
6
To draw the first side, add move block with 80 steps. Then, turn 60 degrees clockwise.
Repeat the same process. Draw the 6 sides using the repeat block:
For the pattern: Ask the user to enter the number of hexagons in the pattern.
All hexagons will be the same size (length = 80 and angle = 60)
Step 1: When the sprite is clicked,
− Repeat the following process answer times (given by user). For each hexagon, do:
o Draw the hexagon with 6 sides of length 80 with turns of 60 degrees in the clockwise
direction (wait for 0.2 seconds between each side). Use Repeat here as well.
o
360
o Turn degrees after drawing each hexagon (to form a circular pattern)
𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎
Modify Activity A-2 from Lab 3 (check if student passed or failed the course) as follows:
- Repeat the process for each student taking the course
- When the sprite is clicked, ask the user for the total number of students
- Use the repeat block to ask user for each student’s mark and display the result (passed or failed)
for 1.5 seconds.