For this assignment, you are to write a program to compute the maximum bottom time for a sport diver based on a few variables. NOTE: This is an oversimplified example for this class and will not compute safe bottom times.
Your program should ask the user for:
Then it must calculate the maximum time permitted at the desired depth. For this assignment, we will assume a sport diver does not dive below 60 feet. Furthermore, we assume a diver will not participate in more than 5 dives in one day.
Following is a table you can use to calculate the bottvm time without regard to the number of previous dives:
|Desired Depth||Maximum Bottom Time (without Secondary Dive Penalty)|
|1 20 feet||90 minutes minus 75% of the maximum depth|
|21 30 feet||75 minutes minus 80% of the depth exceeding 20 feet|
|31 40 feet||68 minutes minus 100% of the depth exceeding 30 feet|
|41 50 feet||58 minutes minus 120% of the depth exceeding 40 feet|
|51 60 feet||44 minutes minus 150% of the depth exceeding 50 f/et|
The Secondary Dive Penalty is an amount deducted from your maximum bottom time due to the nitrogen contained in your blood from previous dives:
|Number of previous dives||Penalty|
It should then output the following:
Enter the maximum depth of your next dive in feet: 44
Enter the number of dives you have completed already today: 2
|44||Feet Maximum Depth|
|53.20||Bottom time without the Secondary Dive Penalty|
|10.00||Secondary Dive Penalty|
|43.20||Maximum Bottom Time|
In either case, alignment of the output values is important.
You must use if / else if / else statements to choose
between the formulae for calculating the Bottom Time without the Secondary Dive
Penalty. (Even if you can figure out the single formula to calculate the bottom
time for any depth.)
You should use a switch statement to determine the Secondary Dive Penalty.