CS105      Lab 4.2 - Class Methods and Inheritance

Objectives:

  1. Before starting this lab you should have read Chapter 4.3 in your text.
     
  2. Start Alice and open the Skater world from the textbook examples.
     
  3. Instead of writing methods for the world, we are going to write methods that define new actions for the object (in this case the skater) alone.  We are then going to define a new class, CleverSkater, who will know how to skate, and spin, etc.  This class then can be used by many different worlds.
     

  4. Follow the instructions on pp110-116 to write the class methods skate and spin for the skater.
     

  5. Follow the instructions on p117-118 on how we can save this as a new class, CleverSkater.
     


  6.  
    Assignment:
    Create an even better skater class as described on p133 #9.
    Be  sure to test out your new class within a new world.


     

  7. Assignment:
    Create a turning combination lock as described on p133 #10.
    Save this new class.

     


  8.  

    Assignment:
    Create a new class TrainedNinja as described on p134 #12.
    Test out your class with a world with two trainedNinjas practicing.


     

  9. Send your worlds AND new classes to me in GoucherLearn.