You are on page 1of 3

Unit 5 Lesson 4

Name(s)___emily z____________________________________________ Period ______ Date


___________________

Activity Guide - Lists Make


Step 1 - Try the app
● Add several reminders to the app.
● Scroll through your reminders.

Discuss with a Partner


● What programming patterns with lists do you think
you'll need to use?

Step 2 - Plan

Lists: This app uses one list. Give it a name! What does it store?

List Name What the List Stores

reminder Reminders

Other Variable: This app uses one extra variable in addition to the list. What does it store?
Variable Name What the Variable Stores

index Different pages

Conditionals: Review the List Scrolling Pattern. Consider how you will use this in your app.

How does it work?


Many App Lab projects run in the following
way.

1. The user is interested in seeing items


in a list, like a list of favorite foods, or a
list of reminders.
2. The app shows the user one item in
the list at a time.
3. By clicking buttons (or otherwise
interacting with the app) the user can
move back and forth through the list,
one item at a time, to see every item.

This pattern allows a user to "scroll" through all


the items in the list. In order to make it work,
create an index variable and a list. Then use
the "Counter Pattern with Boundary" pattern to
create event handlers to change the value of
the index.

This pattern makes sense to use with the


updateScreen pattern since you will need at
least two buttons for scrolling left and right
through the list but afterwards will use the

Computer Science Principles 1


Unit 5 Lesson 4

same code to update the screen.

Function: What code may be repeated in your app? What should be included in your function(s)?
● Hint: Check out how the updateScreen() function is set up in the List Scrolling Pattern.

Each page would have the same code

Inputs: What are the inputs for the app? These will all be turned into onEvents.
Input Action Result

"rightButton" click The reminder stored in the list at the next index is displayed.

leftbutton click The reminder stored in the list at the next index is displayed.

reminder output display Shows reminder at the time set

Reminderinput display Where you type the reminder

Step 3 - Write Your Code


● Write the code for the app, using your plan above and the comments provided in Code Studio to help
● Step You Can Follow
○ Create all the variables (including the list!) from your tables above.
○ Give your variables a starting value using the assignment operator (=).
○ Create a function that updates the screen.
○ Update the output elements on the screen inside of the function.
○ Create event handlers (onEvent) for the inputs in your table above
○ Inside the event handlers, update the appropriate variable using the List Scrolling Pattern. Then call
the update screen function.
○ Use your debugging skills to identify unexpected behavior and fix your program
○ Comment your code as you go, explaining what each event handler and function does
● Extension Ideas
○ Create a button that deletes unwanted items from the list.
○ Change the list scrolling so that it wraps from the end of the list back to the beginning.

Computer Science Principles 2


Unit 5 Lesson 4
Step 4 - Submit
Before you submit check the rubric below to make sure your program meets the requirements of the task.

Category Extensive Evidence Convincing Limited Evidence No Evidence


Evidence

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

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

Processing: Lists The program The program The program The program does
correctly processes correctly processes correctly processes not include or does
the list for all user the list for most user the list for some of not process a list.
interface elements. interface elements. the user interface
elements.

Code: Functions A function is used A function is used A function is used There is no function
which correctly which correctly which updates some which updates the
updates all output updates most of the of the output screen.
elements. The output elements. The elements or the
function is called in function is called in function is only
the appropriate the appropriate called in some of the
onEvents. onEvents. appropriate
onEvents.

Output The screen correctly The screen correctly The screen correctly The screen does not
displays the current displays the current displays some but correctly display any
reminders in all reminders in most not all information. stored information.
instances. instances.

Code runs without No errors are One or two errors Three or four errors More than four errors
errors. present in the are present in the are present in the are present in the
required code. required code. required code. required code.

Coding Comments Comments are used Comments are used Comments are used Comments are not
to correctly explain to explain the to explain the present.
the purpose and purpose and function purpose and function
function of all of most onEvents of some onEvents
onEvents and and functions. and functions.
functions.

Computer Science Principles 3

You might also like