{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

AnalyzeFootball

AnalyzeFootball - sort out.println display out.println...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import static java.lang.System.out; import java.io.File; import java.io.FileNotFoundException; public class AnalyzeFootball { private static AccFootballTeam[] team; public static void main(String[] args) throws FileNotFoundException { team = new AccFootballTeam[4]; team[0] = new AccFootballTeam("unc", "tar heels", "south", 10, 0); team[1] = new AccFootballTeam("dook", "blue devils", "loser", 0, 10); team[2] = new AccFootballTeam("ncsu", "wolfpack", "loser", 1, 9); team[3] = new AccFootballTeam("wfu", "deacons", "south", 3, 7); display();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: sort(); out.println(); display(); out.println(); } public static void sort() { for (int outer = 0; outer < team.length; outer++) { int smallest = outer; for (int inner = outer+1; inner < team.length; inner++) { if (team[inner].getWon() < team[smallest].getWon()) { smallest = inner; } } AccFootballTeam temp = team[outer]; team[outer] = team[smallest]; team[smallest] = temp; } } public static void display() { for (int i = 0; i < 4; i++) { out.println(team[i]); } } public static void sort(CompareElements comp) { } }...
View Full Document

{[ snackBarMessage ]}