0% found this document useful (0 votes)
102 views

Twenty Images With Ids "Icon0", "Icon1" "Icon19" "Color Sbutto N" "Locati Onsbu Tton" "Shap Esbutt On" "Home Scree N"

This document provides instructions for an activity where students will create a program to randomly change images using loops. It includes 4 steps: 1) Try an app with sample inputs, 2) Plan the variables and event handlers needed, 3) Write the code using the plan and comments, 4) Submit and check against a rubric. Tables are provided to plan the variables, event handlers, and rubric categories to ensure loops are used correctly to randomly change 20 images when buttons are clicked.

Uploaded by

Jayden Luke
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

Twenty Images With Ids "Icon0", "Icon1" "Icon19" "Color Sbutto N" "Locati Onsbu Tton" "Shap Esbutt On" "Home Scree N"

This document provides instructions for an activity where students will create a program to randomly change images using loops. It includes 4 steps: 1) Try an app with sample inputs, 2) Plan the variables and event handlers needed, 3) Write the code using the plan and comments, 4) Submit and check against a rubric. Tables are provided to plan the variables, event handlers, and rubric categories to ensure loops are used correctly to randomly change 20 images when buttons are clicked.

Uploaded by

Jayden Luke
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 5 Lesson 8

Name(s)_______________________________________________ Period ______ Date ___________________

Activity Guide - Loops Make


Twenty
"home
Step 1 - Try the app
Try using the different combinations of inputs.
● What does each button change and what does it not
images
Scree
change?
with IDs
n"
Discuss with a Partner
"color
"icon0",
"locati
● Where (if at all) do you think this app is using a list?
● Where (if at all) do you think this app is using a loop?
sButto
"icon1" …
"shap
onsBu
n"
"icon19"
esButt
tton"
Step 2 - Plan
Fill in the information in the table below for each event handler
on"
you'll need to create

Element ID Description of What the Event Handler will Do

colorsButton It changes the color of each of the 20 images.

locationsButton It changes the location of each of the 20 images.

shapesButton It changes the shape of each of the 20 images.

Fill in the table below for each variable you'll need to create.
Variable Name What the Variable Stores

iconshape The shapes of each icon are stored and they are repeated 20 times.

iconcolor The color of each icon could be based off the base color and the colors are the same
for each shape depending on the background color.

Computer Science Principles


This study source was downloaded by 100000826136033 from CourseHero.com on 02-25-2022 16:20:55 GMT -06:00
1

https://www.coursehero.com/file/79579033/Activity-Guide-Loops-Make-Unit-5-Lesson-8docx/
Unit 5 Lesson 8
Step 3 - Write Your Code
● Write the code for the app, using your plan above and the comments provided in Code Studio to help
● Steps You Can Follow
○ Create all the variables from your table above.
○ Give your variables a starting value using the assignment operator (=).
○ Create blank event handlers (onEvent) for each screen element in your table above.
○ Write the code to make each of the three buttons work.
○ HInt: in order to create random colors use the rgba() block with randomNumber(). Read the
documentation for those blocks if you need more help.
○ Use your debugging skills to identify unexpected behavior and fix your program.
○ Comment your code as you go, explaining what each event handler does.
● Extension Ideas
○ Create a way to hide the three buttons when you have a lock screen that you like
○ Add sounds to each button.
○ Change the code for the "shapes" button to guarantee that you never randomly get the same shape
twice in a row.
Step 4 - Submit
Before your submit check the rubric below to make sure your program
Category Extensive Evidence Convincing Limited Evidence No Evidence
Evidence

Input onEvents are created onEvents are created onEvents are created onEvents are not
for all the required for most of the inputs. for some of the inputs. created for any inputs.
inputs.

Variables and Variables and lists are Variables and lists are Some information is There are no variables
Lists created and created and stored in variables and or lists which store the
appropriately used for appropriately used for lists and appropriately necessary information
all pieces of information most pieces of updated throughout for the app to work
used in the app. information used in the app. correctly.
the app.

Loops The program correctly The program correctly The program correctly The program does not
uses loops for all three uses a loop for two of uses lists for one of include or correctly
buttons to generate the the buttons to the buttons to use any loops.
expected output. generate the generate the expected
expected output. output.

Output All three buttons work Only two of the Only one of the None of the buttons
as expected to move buttons work as buttons work as work as expected.
icons, change their expected. expected.
colors, and change
their icon to a random
new icon.

Code runs No errors are present Some errors are Many errors are The code does not
without errors. in the required code. present in the present in the required run.
required code. code.

Comments Comments are used to Comments are used Comments are Comments are not
correctly explain the to explain the present, but are not present.
purpose and purpose and used to explain the
functionality of both the functionality of either purpose or
function and event the function or event functionality of the
handlers. handlers. function or event
handlers.

Computer Science Principles


This study source was downloaded by 100000826136033 from CourseHero.com on 02-25-2022 16:20:55 GMT -06:00
2

https://www.coursehero.com/file/79579033/Activity-Guide-Loops-Make-Unit-5-Lesson-8docx/
Powered by TCPDF (www.tcpdf.org)

You might also like