the code that is attached it what i have done so far but dont seem to be able to get the test file to get it to display the informationthe code i have is shown below
import java.io.*;
import java.util.*;
public class league{
private static final int MAX_TEAMS = 50;
private int noteam;
private team[] myleague = new team[MAX_TEAMS];
public void readleague(){
String file = "matches.txt";
String line;
int noteam=0;
try
{
FileReader fr = new FileReader (file);
BufferedReader inFile = new BufferedReader(fr);
line = inFile.readLine();
while ((line != null)&&(noteam<MAX_TEAMS)){
StringTokenizer st = new StringTokenizer(line,",");
myteam[noMatches] = new team(st.nextToken(),
st.nextToken(),
String.parseInt(st.nextToken()));
line=inFile.readLine();
noteam++;
}
inFile.close();
}
catch(IOException e){
System.out.println("Cannot open matches file");
}
}
public void displayleague(){
for (int i = 0;i<noteam;i++){
System.out.print("hometeam:"+myleague[i].gethometeam());
System.out.print("\t homescore:"+myleague[i].gethomescore());
System.out.print("\t awayteam:"+myleague[i].get awayteam());
System.out.println("\t awayscore:"+myleague[i].getawayscore());
}
}}
public class football{
private String hometeam;
privte int homescore;
private String awayteam;
private awayscore;
//private int result ;
public football(String hometeam, int homescore,String awayteam, int awayscore ){
this.hometeam=hometeam;
this.homescore=homescore;
this.awayteam=awayteam;
this.awayscore=awayscore;
//this.result=result;
}
public football(){
}
public String gethometeam(){
return hometeam;
}
public int gethomescore(){
return homescore;
}
public String getawayteam(){
return awayteam;
}
public int getawayscore(){
return awayscore;
import java.io.*;
public class leaguetest{
public static void main(String args[]) throws IOException{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader stdin = new BufferedReader (isr);
League locatedfootball = new League();
String hometeam;
//int homescore
//String awayteam
//int awayscore
League team=new League();
team.displayLeague();
//bbit4.sortleague();
team.displayLeague();
system.out.print(" hometeam:");
hometeam=stdin.readLine();
locatedfootball=team.findfootball(hometeam);
if(locatedfootball==null){
system.out.println("team not found");
}
else{
System.out.print("hometeam:"+locatedfootball[i].gethometeam());
//System.out.print("\t homescore:"+locatedfootball[i].gethomescore());
//System.out.print("\t awayteam:"+locatedfootball[i].getawayteam());
//System.out.println("\t awayscore:"+locatedfootball[i].getawayscore());
}
}
}