I'm building a graph that lists ranking, name, an old statistic, a new statistic, and the change in them ( in that order). I have so far used the code
for (int rank = 0; rank < 5; rank++) {
String name = scnr.next();
int pop16 = scnr.nextInt();
int pop11 = scnr.nextInt();
canada.add(new Jurisdiction (name, pop16, pop11));
System.out.printf(format1, rank+1, canada.get(rank).getName(), canada.get(rank).getPop16(), canada.get(rank).getPop16(), canada.get(rank).calculateChange());
}
to find the first 5 instances however when it tries to read a name with more than one word for example "West End" or "New England" it stops. I'm trying to figure out just exactly how I can get past this issue using different variations of the next()
method or if theres something else I can do to solve my problem.
AND before you ask the text file im using is formatted specifically so it goes
stringName intOldStat intNewStat
so using nextLine()
isnt really an option.
I need 13 instances of the different names and stats for reference.