# CSCI 1300 Project: Emptying a Tank

This is one of several possible projects for CSCI 1300. The following link tells how the projects are used:

## What the Program Should Do

Write a program which draws a side view of a large cylindrical fuel tank on the graphics screen. The tank has a small valve on the side, which is initially shut. The input to the program (from the keyboard) consists of three numbers: The height and diameter of the tank (in feet) and the diameter of the nozzle (in inches). After reading the diameter of the nozzle, the program should convert this number to feet (so that all measurements are stored using feet as the unit).

The program should allow the user to click the right mouse button to open the valve (and the tank starts draining), or click the left mouse button to close the value. While the tank is emptying, the graphical display should show a representation of how high the full is using some appropriate scale.

Use these equations to figure out how fast the tank drains:

• Volume of fuel lost during each one minute period is this many cubic feet: velocity of the fuel coming out of the nozzle (in feet per second) times the area of the nozzle (measured in square feet) times 60.
• Velocity of the fuel (in feet per second) is: 8.02 times the square root of the height of the fluid (measured in feet).

The program uses multiplicative factors of 60 and 8.02. Declare these as constants in your program.

NOTES:

• I expect to see you define and use sensible functions. For example, a function to calculate the volume of fluid in a cylinder. And another function to compute the height of fluid in a cylinder when you know the diameter and the volume.

• After reading the input information, the program should draw a graphical representation of the fuel in the tank with the nozzle shut. The fluid should drain from the tank using about one second of the user's time for each minute of fuel draining. The user can also click the left mouse button to close the nozzle or the right button to open the nozzle.

Note: Within the program's loop you can execute the statement `delay(1000);` to cause the program to pause for 1000 milliseconds.