In a certain sports league, a group of teams plays through a Schedule of Game. At the end of this Schedule, they want to determine the winner.

To determine the winner, you will have to determine for each team how many Games they won, lost, and tied. Assuming 2 points for a win, 1 point for a tie, and 0 point for a loss, you can then determine how many points they scored during the season. The team(s) with the most points is then the winner.

My question is, what would total be equal to?

My Code:

import java.lang.*;

public class Winner{
  public static void main (String[] args){

     Schedule sc = new Schedule();                                           
     String[] teams = {"Vancouver", "Calgary", "Edmonton", "Toronto", "Ottawa", "Montreal"};  
     int[] wins = new int[teams.length];  
     int[] losses = new int[teams.length];
     int[] ties = new int[teams.length]; 

     Game[] games = new Game[sc.GAMES];  

     for (int i=0; i<sc.GAMES; i++){      
         int inHome, inAway, scoreHome, scoreAway;

         inHome = indexOfTeam(games[i].getHomeTeam(), teams); 
         inAway = indexOfTeam(games[i].getAwayTeam(), teams); 
         scoreHome = games[i].getHomeScore();                        
         scoreAway = games[i].getAwayScore();                
  if (scoreHome > scoreAway){                                
         else if (scoreHome == scoreAway){                    

     int peak = 0;                                
     int[] total = new int[teams.length];         

     for (int i=0; i<teams.length; i++){                    
         total[i] = ;
         if (total[i] > peak) peak = total[i];

         System.out.println(teams[i]+" - " + wins[i] + " wins, " + losses[i] + " losses, " + ties[i] + " ties = " + total[i]);

     System.out.println("The season winner(s) with " + peak + " points:" + teams);  

     for (int i=0; i<teams.length; i++){
       if (peak < total[i]) peak = total[i];


  static int indexOfTeam(String team, String[] teams){  

      for (int i=0; i<teams.length; i++)
        if (team.compareTo(teams[i]) == 0) return i;
      return -1;

I think it would be the addition of the wins and ties. Wins are worth two points and ties are worth one. Losses wouldn't be considered because the teams receive zero points. Add those up and see which team has the most combined. Just my guess.

This article has been dead for over six months. Start a new discussion instead.