90 likes | 108 Views
CS 104 – Fall 2011 Exploring Computer Science. Lecture 20: November 14, 2011 Procedural Abstraction and List Processing. Schedule. Today Procedural Abstraction in App Inventor List Processing in App Inventor High Score List Processor Wednesday No quiz
E N D
CS 104 – Fall 2011Exploring Computer Science Lecture 20: November 14, 2011 Procedural Abstraction and List Processing
Schedule • Today • Procedural Abstraction in App Inventor • List Processing in App Inventor • High Score List Processor • Wednesday • No quiz • Return quizzes 5 and 6; last team homework • Big Data Lecture • Storing Databases • Next Monday • Exam 2 • Focus on App Inventor
General Idea • Project example for today • Allow the user to enter high scores • Maintain a list of the top-5 highest scores • Requirements • Procedure to initialize a list • Procedure to insert a new score into the proper location • Procedure to print contents of list to a textbox
List Processing • Lists in App Inventor are similar to those in BYOB • Creating a list, selecting/replacing/removing/inserting • Functions for checking membership, location of an item, contents empty • An error when going beyond the size of a list
Iterating over a list • App Inventor offers the forRange and forEach control constructs
App Inventor Procedures • App Inventor provides procedures that can receive arguments, and either return a result (like BYOB reporter) or not return a result (like BYOB command)
High Score List Keeper • Variable declarations and simple events
High Score List Keeper • insertItem