# Portfolio Problems

Drawing pictures

1. 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`.

2. 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`.

3. Problem 14.2 in the text (page 139).

4. Problem 14.6 in the text (page 143).

# Pair Programming Assignment

## 4.1  Problem

Collect the data definitions that represent a river system. Then solve the Problem 15.8 in the text (page 175).

## 4.2  Problem

1. Finish the definition of the class `Fish` from Lab 4.

2. Finish the definition of the class `Shark` from Lab 4.

3. 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.

## 4.3  Problem

Start with your `OceanWorld` solution and make the following enhancements:

1. 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 `*/`

2. 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.

3. 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.

## 4.4  Problem

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.