The program takes the temperature in Fahrenheit then calculates it's Celcius temperature, then outputs them next to each other. It adds 20 to Fahrenheit after each loop. I used a for loop for this and have it just go up until Fahrenheit hits 300.
What I need to do, is get the Fahrenheit temperatures in one array, and the Celsius ones in another.
The problem I didn't understand is:
1) I know my array will need 15 elements (since Fahrenheit starts at 0 and goes up by 20 until it reaches 300) - should I just go ahead and declare each array to [15] or is there a way to leave the array blank [] so it can "dynamically" size up as elements are added?
2) I know I will need to put each variable into the array each time it runs through the for loop. Could someone maybe point more towards how I should structure my loop? I am 99% sure the array loop would have to run inside the for loop calculating the information (since the variables change each loop) - but I am just really lost on how to structure that.
3) Am I going in the right directions or completely off track?
Then I have to spit the two array back out (which I did figure out how to do with a for loop so that's no problem)
Thanks guys, hope to get some good insight
public class ConversionTable { public static void main(String[] args) { double fahr; double cel; double[] tempList1; double[] tempList2; tempList1 = new double[15]; tempList2 = new double[15]; System.out.print("Fahrenhit |"); System.out.print(" Celsius"); System.out.println("\n----------------------"); for(fahr=0;fahr<=300;fahr+=20) { cel = (5.0/9.0)*(fahr-32.0); tempList1[] = fahr; tempList2[] = cel; } // Below is a for loop I was trying to make for the array for (int i = 0; i > tempList1.length; i++) { } System.out.println(tempList1.length); System.out.println(tempList2.length); } } }