I'm writing a program where it calculates the final temperature of a pie based off the variables I input.
For instance:
Input : 425 60 -0.01 3 1
I need a way to separate the numbers into variables that I can use.
This is my attempt:
However, I get this error after the first line prints out:
java.lang.NumberFormatException: For input string: ""
Help appreciated!
System.out.println("Input variables Tp, Tr, k, Q, m followed by an space between each.");
String l = in.nextLine();
String[] arr = l.split(" ");
ArrayList<Integer> aList = new ArrayList<Integer>();
for (String s : arr){
aList.add(Integer.parseInt(s));
}
int Tp = aList.get(0);
int Tr = aList.get(1);
double k = aList.get(2);
int Q = aList.get(3);
int m = aList.get(4);
double total = 0;
