COMP363 Java Programming Assignment 1

Lake Level Simulation

due September 23, 1999

Due to drought conditions during the last few years, Greensboro has been concerned about its water supply and reservoir levels. You are to write a program that will simulate the water level in three lakes. Rain increases the depth of the lakes while the city water supply and evaporation lowers the water level. When a lake fills past its overflow depth, the water will flow into another lake or into a river and out of the system. Your program will read in the daily rainfall and display the level of each of the three lakes.

For simplicity, we will assume that the lakes are cylindrical. That is, the surface area of the lake does not change with the water level. We will also assume that when it rains, the same amount of rain falls on all lakes and watersheds.

Rain increases the depth of the lakes. Rain that falls directly into the lake adds to the depth as does water that flows into the lake from streams in the lake’s watershed. While all of the water that falls directly into the lake increases the lake depth, only some of the water that falls on the ground in the watershed will flow into the lake. The ground will absorb the first 2 millimeters of any rainfall in a day. If more than 2 millimeters of rain fall in a day, 75% of the additional rain will flow into the lakes.

The city uses 12 million liters of water from Crystal Lake every day. Water evaporates from all of the lakes lowering the lake levels an average of 1.0 millimeter per day.

Channels connect the lakes. If the depth of a lake exceeds its overflow depth, then water will flow into the next lake or into a river. Water can flow through the channels at the rate of 20 million liters per day. Water stops flowing in the channel when the depth of the lake drops below its overflow depth.

The table below defines properties of the lakes.



current depth (m)

overflow depth (m)





flows into






Bear Lake






Crystal Lake








The daily rainfall for a two week period was:

day rainfall (cm)

  1. 0
  2. 0
  3. 0.5
  4. 0.1
  5. 0
  6. 0
  7. 0
  8. 2.5
  9. 0
  10. 0.3
  11. 0
  12. 0
  13. 0.5
  14. 0


Useful conversion factors:

1000 liters = 1 cubic meter 1 hectare = 10,000 sq. meters

1000 millimeters = 100 centimeters = 1 meter