Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

Thread: Method for a table for calculation - help!

1. Method for a table for calculation - help!

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.

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() {
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();
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);
}```

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.