ie.
5 // 5 tests cases within file
9 // first test case has 9 locations
100 500 //lab1 coordinates
0 0 // lab2 coordinates
300 200
400 500
500 100
0 400
500 200
100 200
500 300
0 6 6 6 6 6 6 6 6 6 // amount of files at each lab
I need to be able to use each line separate
I'm a little rusty at java but i have so far
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class A1 {
public static void main(String[] args) throws IOException{
file_parser();
}
public static void file_parser() throws IOException{
String line,file_name;
Scanner filescan;
int[] intArray = new int[1024];
Scanner user_input = new Scanner(System.in);
System.out.println("enter file name");
file_name = user_input.next();
filescan = new Scanner(new File(file_name));
while(filescan.hasNext()){
int i = 0;
line = filescan.nextLine();
intArray=int_parser(line);
System.out.println(intArray[i]);
}
}
public static int[] int_parser(String parse){
int[] intArray = new int[parse.length()];
for(int i = 0; i < parse.length(); i++){
intArray[i] = Character.digit(parse.charAt(i), 10);
}
return intArray;
}
}
any help would be awsome

New Topic/Question
Reply



MultiQuote




|