I am making a calculator for divers as an assignment for school, for one of the calculations I am meant to make a table which should look similar to the following.
Which calcuation do you wish to perform (Help/MOD/SMOD/BM/PP/PPT/EAD/EADT)? EADT
Generating Equivalent Air Depths Table
Enter a start and end percentage of Oxygen: 21 25
Enter a start and end depth (in metres): 3 31
Equivalent Air Depth Table for 21 to 25 percent Oxygen and depths of 3 to 31 metres
================================================== =================================
n 21 22 23 24 25
3 3 3 3 3 2
6 6 6 6 5 5
9 9 9 9 8 8
12 12 12 11 11 11
15 15 15 14 14 14
18 18 18 17 17 17
21 21 21 20 20 19
24 24 24 23 23 22
27 27 27 26 26 25
30 30 29 29 28 28
So the user will input two numbers for percentage and two for depth which will make up this table and the insides will be created by the equation (i'm assuming) and i can't figure out how to make this. what i've come up with so far is:
public static double printEADT() { double eadt; Scanner scan = new Scanner (System.in); System.out.println("Generating Equivalent Air Depths Table"); System.out.println("Enter a start and end percentage of Oxygen: "); double startpercentage = scan.nextDouble(); double endpercentage = scan.nextDouble(); System.out.println("Enter a start and end depth (in metres): "); double startdepth = scan.nextDouble(); double enddepth = scan.nextDouble(); eadt = ((1-(1.4/startdepth)*100)*((startpercentage/100)*((startdepth/10)+1))/0.79); System.out.println("Equivalent Air Depth Table for " + startpercentage + " to " + endpercentage + " percent Oxygen and depths of " + startdepth + " to " + enddepth + " metres"); do { System.out.print("\t" + startpercentage); startpercentage+=1; startdepth+=1; } while (startpercentage <= endpercentage); System.out.println(""); do { System.out.println(startdepth + "\n"); startdepth+=1; } while (startdepth <= enddepth); return eadt; }
it makes the first line but not the second and i'm not sure why.
i've attached the entire file if you want to see all the code.
please please help i'm desperate.