CPSC 110-08: Computing with Mobile Phones
Reading: App Inventor, Create Your Own Apps, Chapter 20
Due: Friday 9/30 (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
Principles addressed:
Algorithms: loops
Programming:
Read Chapter
20, Repeating
Blocks, focusing in particular on the simple for each
and while loop sections. This chapter describes
the looping control structures, important elements in designing
algorithms.
Reading Questions. Provide answers to the following
two questions on a Portfolio page for this reading assignment.
- Consider the following Pseudocode algorithm. What
would be the value stored in Count as a result of this algorithm.
To determine this answer, you should hand trace the algorithm, keeping
track of how the values of N and Count change.
Set N to 100
Set Count to 0
While N > 0 do:
Set N to N - 20
Set Count to Count + 1
- Construct a set of App Inventor Blocks to test your answer
to the previous question. Test your code by right clicking
on blocks and using the Watch and Do it options.
(Remember that to use those options your app must be running
on the emulator or phone.)
Provide a screen shot of your blocks as your answer to this question.
- Complete this exercise from the Algorithms Lecture, reprinted here:
- Write a Pseudocode algorithm to compute whether or not a number is odd, storing
the result, true or false, in a global variable.
- Using your isOdd algorithm as a part, write a Pseudocode
algorithm to sum all the odd numbers in MyList storing
the result in Sum.
- Test your algorithm by tracing it step-by-step on the list (14 5 3 21 5 6)
- Write an App Inventor version of this algorithm.
- Test your App Inventor algorithm by right clicking on blocks and using Watch and Do it.
In Class on Friday
We will go over these and look at examples that use loops.