daedalus177/Project-4 — pull request #1 by daedalus177 (2014-04-18 00:10:55+00:00)
Title: Create project4rough

public static void viewFutureFixtures()throws IOException
{
/* This method compares the length of the results array and the length of the fixtures array.
if the results array is shorter than the fixtures, the remaining details of the fixtures array are
displayed to the user as fixtures yet to be played.*/
String team1 = "", team2 = "", result = "", tempWord, tempWord1 = "";
tempWord = teamsArrayList.get(0).getTeamName();//assigns first team in teamsArrayList to temp word.

//loop to assign the longest team name to tempWord
for(int x = 0; x < teamsArrayList.size(); x++)
{
tempWord1 = teamsArrayList.get(x).getTeamName();

if(tempWord1.length() > tempWord.length())
{
tempWord = tempWord1;
}
}

int t0 ,t1, t2, x, lw;
lw = tempWord.length();

x = fixtureArrayList.size();

if(fixtureArrayList.size() > resultsArrayList.size())
{
result += "\t\tFixtures yet to be played\n";
result += "FIXTURE No. \tHOME TEAM \t\t\t AWAY TEAM\n";
for(int i = i = resultsArrayList.size(); i < x ; i++)
{
t0 = fixtureArrayList.get(i).getFixtureNumber();//--method call to Fixture class
t1 = fixtureArrayList.get(i).getHomeFixture();//--method call to Fixture class
t2 = fixtureArrayList.get(i).getAwayFixture();//--method call to Fixture class
for(int j = 0; j < teamsArrayList.size(); j++)
{
//A number of calls to Teams class to get team names and assign them to a local string
if(t1 == teamsArrayList.get(j).getTeamNumber())
{
team1 = teamsArrayList.get(j).getTeamName();
}
if(t2 == teamsArrayList.get(j).getTeamNumber())
{
team2 = teamsArrayList.get(j).getTeamName();
}

}
//this if statement assigns all teams to the same length for output purposes
if(team1.length() < lw)
{
for(int k = team1.length(); k < lw; k++)
{
team1 += " ";
}
}

result += (t0 + "\t\t" + team1 + "\tVs\t " + team2 + "\n");
}
System.out.print(result);
}
}