Using Java, im reading in an input file using scanner and i am able to read and print out the input file. But i am having difficulty parsing it now.
The example input file is as follows :
height 6
weight 120
name john
team played for team1 start 2010 end 2012
team played for team1 start 2010 end 2012
team played for team2 start 2013 end 2015
how do i go about parsing this information. currently im scanning the input by line like:
while (scanner.hasNext()) {
String line = scanner.nextLine();
System.out.println(line);
}
would i do something like
int height = height.nextInt();
int weight = weight.nextInt();
String name = name.nextLine();
and now im stuck with the last 3 lines, assuming the first 3 lines were parsed correctly