CPSC 110-08: Computing with Mobile Phones

Reading: App Inventor, Create Your Own Apps, Chapter 20
Due: Wednesday 10/26 (before class)

Textbook

You can purchase a copy of the text book Wolber, Abelson, Spertus, and Looney, App Inventor: Create Your Own Android Apps. It costs around $25. We will be having reading assignments from this text throughout the semester.

There is a pre-publication version of this book available for free download. However, it is not as complete as the published version.

Reading Assignment

Read Chapter 20 and 21 (up to page 286), Programming Lists Blocks and Loops. In Chapter focusing in particular on the for each loop section. These chapters focus on concepts we will need for list processing.

Reading Questions

Provide answers to the following two questions on a Portfolio page for this reading assignment.

  1. Suppose you have the following list: (300, 100, 200, 200) named AList. What value for A would be computed by the following algorithm?
    Set A to 0
    Set K to 1
    While K <= length(AList) do:
      Set A to A + selectListItem(K, AList)  # Select the kth item from AList
      Set K to K + 1
    Set A to A / length(List)
    

  2. Write a function in Pseudocode and App Inventor named avgList that will compute and return the average of list. This function should have 1 argument, aList, a place holder for a list. Test your function by calling it with the two different lists, e.g., AList and another list with a different name and different elements. It should give the correct average in each case.

In Class on Friday

We will go over these and look at examples that use lists and loops.