I have these objects of arrays with information stored in them which i have extracted from a file. How can change these into an array, i think i am meant to use 2D arrays, i want to sort them and display the corresponding information from them.
while(kd.hasNext()){
String data = kd.nextLine();
String [] values = data.split(",");
String wScore = "N/A" , lScore = "N/A", crowd = "N/A";
String year = values[0];
String premiers = values[1];
String runnersUp = values[2];
if (values.length > 6)
{wScore= values[6];}
if (values.length > 7)
{lScore= values[7];}
if (values.length > 8)
{crowd= values[8];}
This is one line of the information in a very large file.
2005,Arsenal,ManU,Arsenal,WestHam,Y,2,3,40000
So if the user enters:
2005
I want the program to display:
Year: 2005
Premiers: Arsenal
Runner Up: ManU
Minor Premier: Arsenal
etc..
I try using a for loop for length of the array, but as i dont have the years and all the other objects in an array, i cant use that. I was wondering if anyone has a solution to that.
I am not allowed to use HashMap, ArrayList, collections and Open CSV according to my teacher.