With this Arraylist - Strings [] teams = {"Golds", "Dragons", "Brooms", "Bruins", "Blues", "Seahawks", "Sooners", "Trojans"};

1. Code a method public void playGame(int teamA, int teamB, ArryList< string> 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 Quiddich 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 Golden snitch. If that happens the game ends immediately and that team wins. (First determine if a team got the snitch, then if one did randomize which one wins with even probability.)

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 snitch.

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 Tourney

2. 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 programs 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.

Round #1
======================================
Dwarves vs Wizards
-------------------------
Qtr 1: 2 4
Qtr 2: 3 1
Qtr 3: 0 2
Qtr 4: 2 2
Wizards Win 9 to 7 Dwarves eliminated
--------------------------
etc. rest of round #1 games follow
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.