mardi 21 juin 2016

Lost on Arrays for a team assignment

Good day everyone, I am new to this and I need major help with an assignment with limited understanding and guidance at this time. Below are a copy of instructions. As students we have managed to help one another but we are lost on this and looking elsewhere for assistance. Please help

  1. Create an ArrayList of Strings containing the names of your teams

  2. Code a method public void playGame(int teamA, int teamB, ArryList teams)
    a. teamA and teamB are the indices (sic. Indexes) of the teams that are playing the current game. You will use these to retrieve the String name of the team.
    For our purposes a game has four quarters:
    b. Each team randomly scores 0 to 4 goals worth 10 points each per quarter (0 – 40 points per quarter. c. Each quarter, there is a 15% chance that a team will capture the magic flag. If that happens the game ends immediately and that team wins.
    d. The method should display the results for each quarter that is played and indicate the final score or if the teams won by capturing the flag.
    e. There are no ties. Play additional sudden death quarters until one team wins.
    f. Your method should remove the loosing team from the ArrayList and print a msg that that team (using the String name) has been eliminated from the Tournament.

  3. Code your main program to display the list of teams. Then run the tournament. For each round pit every other team against one another.
    a. First round: 4 games reduces teams to 4 remaining.
    b. Second round: 2 games reduces teams to final 2
    c. Final round: 1 game determines the tournament winner.

Each time show the list of remaining teams and use your method to run the games for that round. (Hint: just use even/odd indices for the pairings: Team index 0 plays team index 1, team index 2 plays team index 3, etc.)

d. NOTE: use the printf output method, tabs t, and divider lines to reasonably style your program’s output similar to the example below. Some of this code is in the method and some will be in the main program that calls it.

Aucun commentaire:

Enregistrer un commentaire