Class Work
Topic 4 -1:World Level Methods
1. Complete Chapter 4, exercise 2 on page 110 from the Learning to Program with Alice textbook. The problem is restated here for those who do not have the book.
The point of this exercise is to create some world level methods and to think about how to make a realistic hopping motion for a kangaroo object.
Confused Kanga. Scrounging for breakfast in the outback, Kanga (kangaroo from Animals) encounters a rather confusing sign. (Roads and Signs folder). Kanga stares at the sign for a few seconds and tilts her head sideways to show that she is confused. Kanga then hops left and turns toward the sign and then hops right and turns toward the sign and then left and then right.
Create a simulation that implements this story. Write methods hopLeft (Kanga turns left and small amount and hops, and then turns to face the sign) and hopRight (Kanga turns right a small amount and hops, then turns to face the sign). With each hop, Kanga should make some progress towards the sign. In World.my first method, alternate calls to hopLeft and hopRight methods (twice) to make Kanga take a zigZag path toward the sign.
