©2008 Felleisen, Proulx, et. al.
Drawing pictures
Complete the first part of the lab. In Examples
class
construct an instance of the IShape
hierarchy that
represents a drawing of a tree with a black trunk, green leaves and
a red apple among the leaves. Show the drawing in a Canvas
.
Problem 14.1 in the text (page 139). Include your drawings in the
Examples
class and show the drawings in separate instances
of the Canvas
.
Problem 14.2 in the text (page 139).
Problem 14.6 in the text (page 143).
Collect the data definitions that represent a river system. Then solve the Problem 15.8 in the text (page 175).
Finish the definition of the class Fish
from Lab
4.
Finish the definition of the class Shark
from Lab
4.
Finish the design of the OceanWorld
from Lab 4.
Save the work and hand it in as one program.
Watch the wiki for instruction how you can run the game.
Start with your OceanWorld
solution and make the
following enhancements:
Replace one fish with a school of fish. Include in your program
a detailed description (in English) of what happens when the shark
eats a fish. Write it a a Java multi-line comment — starting with
/*
and ending with */
Modify the definition of the class Shark
so that the
player can see how starved or full the shark is. Also, limit shark’s
growth, so it cannot increase its lifespan beyond some fixed limit.
Modify the definition of the class Fish
so that every
fish swims at its own speed.
Save the work and hand it in as one program.
This is an optional extra credit part of the assignment. You will get credit for this work only if the program design follows the DESIGN RECIPE.
Make enhancements to the game, such as allowing the fish to move up and down as well, assigning different food value to fish of different color, designating one fish color as poison that kills the shark, counting the number of fish that escaped shark’s jaws — and even displaying the score, making the drawings of the shark and the fish be somewhat realistic, etc.
Describe each enhancement in a brief paragraph and include it with your program.