Fundamentals of Programming

"Success is the ability to go from one failure to another with no loss of enthusiasm." Winston Churchill

Chapter 4 Exercises

Name____________________________ Checked By: ____________________________

  1. ___ / 10 pts Chapter 4-1, Example - CleverSkater (Skater with methods) [Page 100-106]
    • ____ Commenting (3 pts)
    • ____ Method - IceSkater.skate will slide left then slide right at the same time moving forward (3 pts)
    • ____ Method - IceSkater.spin will move leg in and out as skater spins, arms come in as skater spins, return left leg to starting position after spin (4 pts)
  2. ___ / 18 pts Chapter 4-1, Exercise 1 - LockCombination [Page 109]
    • ____ Commenting (3 pts)
    • ____ Initial World - adding TurningComboLock object (1 pt)
    • ____ Methods - TurningComboLock.leftOne, TurningComboLock.rightOne, TurningComboLock.leftRevolution, and TurningComboLock.rightRevolution that turn the dial on the lock 1 number to the left/right, 1 revolution to the left/right, (4pts)
    • ____ Methods - TurningComboLock.open & TurningComboLock.close the lock (2 pts)
    • ____ Combination - Left 25, then Right 16, then Left 3 (3 pts).
    • ____ Combination - when going Right 16, dial turns one full revolution by passing 16 once and stopping on it the second time (2pts)
    • ____ Combination - Pop open the latch, close the latch, and return the dial to zero (3 pts)
  3. ___ / 13 pts Chapter 4-1, Exercise 2 - FunkyChicken
    • ____ Commenting & CoolChicken to world (3 pts)
    • ____ Method - CoolChicken.walk left step then right step (2 pts)
    • ____ Method to make the chicken perform a “funkyChicken” dance motion. (4 pts)
    • ____ World - CoolChicken.funkyChicken method playing sound & say instructions (4 pts)
  4. ___ / 14 pts Chapter 4-1, Exercise 3– Samurai Practice
    • ____ Commenting and TrainedSamurai. saved (4 pts)
    • ____ Methods - TrainedSamurai.rightJab and TrainedSamurai.leftJab - (2 pts)
    • ____ Methods - TrainedSamurai.kickLeft and TrainedSamurai.kickRight for Samurai (2 pts)
    • ____ Methods - TrainedSamurai.leftSpin and TrainedSamurai.rightSpin for Samurai (2 pts).
    • ____ World - add two TrainedSamurai practicing moves facing each other (4 pts)

TOTAL SCORE: ______ / 55 points