CompSci 94 - Classwork 8 - Sept. 19, 2013
10 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. You will write two Alice worlds for this
classwork.
The following work needs to be checked off when you have completed it.
- WORLD 1:
- 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.
- Put code in world.my first method
that uses illustrates the use of 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,
since they will automatically be called.
- 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
one of them should have at least one parameter.
- You must use asSeenBy in one of the new methods.
- You must use isShowing in one of the new methods.
- Put code in world.myFirstMethod to demonstrate all these methods.
- Rename the class and save out the new class.
- WORLD 2:
- Create a world with a different background.
- Import both of your new classes into this world and write code in
myFirstMethod to illustrate all their methods.
- Add in two invisible objects in your world spaced apart and not too
close to the other objects.
- Somewhere in your code, have one of your objects move (they don't have to walk) over to the
first
invisible object then to the second invisible object and then to the other
imported object, stop 1 meter in front of
this object and say "Oh there you are." to that
object. You'll need to use the
distance to function with math.
If you finish early, feel free to embelish your animations.