1. This is a simple assignment to check that you can work with lists. Make
a world DanceOfTheToasters.a2w. Put 6 toasters into a list. In
my first method, make each of them hop once (just up and down).
Be sure to use a for all in order loop. As always, feel free to
use something else than toasters.
Grading criteria:
a) Do they hop?
b) Is a list and a for all in order used?
10 points.
2. This is a simple assignment to reinforce the lab. Enhance the “Find the tallest” program of the lecture on lists. As stated in the lab, you should have the tallest person brag about their height, but first line up the people so that it is easy to see who is the tallest. (Hint: Use the previous lab.) I will test your program by adjusting the heights of your people and moving them around before clicking Play.
10 points.
Grading criteria
a) After moving around some people, are they lined up when the world is played?
b) After doubling the height of one of the people, does that one claim to be the tallest?
3. In the lecture on lists, you modified the
LineUp.a2w program so that each item in the list lined up one meter to the
left of objectAtRight. The tricky part was to update
objectAtRight in the loop.
In this assignment, you will use a different strategy to implement the
lineUp method.
Keep a local variable distance. As the for all
loop is traversed, you should update that variable to have values 1, 2, 3, 4,
...
Then move the item so that it is distance away from the
toaster.
Turn in a file LineUp2.a2w with your modified
lineUp method. Populate your peopleList with some
characters of your choice.
20 points.
Grading criteria
a) Is peopleList populated?
b) Does the line up work?
c) Is there a distance variable? Is it a local variable of
lineUp?
d) Did you remove the (now useless) objectAtRight
variable?