I am supposed to parse:
ABC Store
3.19
2.12
1.99
10
the following elements into String and Doubles and assign them into one array.
while(scan.hasNextLine())
{
String line = scan.nextLine();
String [] arr = new String [5];
arr[0] = scan.nextLine();
double num1= Double.parseDouble(arr[1]);
double num2 = Double.parseDouble(arr[2]);
double num3= Double.parseDouble(arr[3]);
double num4= Double.parseDouble(arr[4]);
System.out.println (Arrays.toString(arr));
}
I have this so far, but this code seems not working.
Comments
Post a Comment