CompSci 4 - Classwork - Sep 22, 2005
5 pts
Today's classwork goes along with Chapter 4, Section 3.
You will be writing class methods and then saving the classes to
reuse in other worlds.
The following work needs to be checked off when you have completed it.
- Write a new class that is inherited from another class of some
creature (person or animal) that has 4 or more limbs.
- Create at least four new meaningful methods that each have several
lines of code.
- At least one of the new methods should invoke one of the other methods.
For example in the cleverSkater class, the skate method invokes the
slideLeft and slideRight methods.
- At least one of the new methods should use at least one parameter.
- Write a method (it may be world.my first method)
that uses all the new methods in the class. You do not have to
invoke those methods that are invoked in one of the other new methods.
- Rename the class and save out the new class.
- Write another new class.
This one can be inherited from any Alice object,
not necessarily a creature. This class should be created in the same
world.
- This class should have at least four meaningful methods. At least
two of them should have one or more parameters.
- You must use asSeenBy in one of the new methods.
- Rename the class and save out the new class.
- Create a new world and use both of your new classes.
Again
write a method (it may be my first world.my first method)
that illustrates the use of all the new methods in both classes.
You do not have to
invoke those methods that are invoked in one of the other new methods.
- You must use isShowing somewhere in your new world. It could be
in one of your class-level methods or in a world method.
If you finish early, feel free to embelish your animations.