Class Work
Topic 4-3-1: Lock Combination
1. Complete Chapter 4, exercise 10 on page 113 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 class level methods
Lock Combination. Create a wprld with a comboLock (Objects folder). Create four class-level methods: leftOne, rightOne, leftRevolution, and rightRevolution. These methods turn the dial on the lock 1 number left, 1 number right, 1 revolution left, and 1 revolution right. Then create a class-level method named open that shows the lock dialing through a combination and then opening. Then create another class-level method named close, that shows the lock closing and the dial being spun to lock it. Rename ComboLock as TurningComboLock and save it as a new class.
Hint.
Call methods on the sub parts of the lock (dial and latch.)
To turn the dial use the roll method. (not the turn).
One position on the dial is actually about 1/40th of a revolution.
Use the endGently style to make the motion more realistic.
The initial scene can be downloaded from the web.