This assignment is due by 2:00 p.m. on Tuesday, 8 July.
See the assignment turn-in page (last modified on 16 July 2003) for instructions on
turning in your assignment.
Do Problem 4.39 in Andrews, The Bear and the Honeybees. Here are a few
clarifications about the problem:
- A bee that tries to store honey in the pot while the bear is eating
will be eaten by the bear.
- If the bear tries to eat the honey before the pot is full, the bees
will sting the bear.
- A bee that tries to add honey to a full pot will drown (this is
before the bear gets to the full pot; afterwards, the bee will be
eaten by the bear).
- Your solution should allow the bees to fill the pot as quickly as
possible.
Use Java to solve the problem. You may solve the problem anyway you like, but
your solution should use a honey pot that implements the interface
interface HoneyPotInterface {
public void bearEnter();
public void bearExit();
public void beeEnter();
public void beeExit();
}
You can also find the source file in
/export/home/class/cs-598/a5
from any cslab machine or rockhopper.
This page last modified on 7 July 2003.