1. Engineering
  2. Computer Science
  3. modify the method so that instead of manually making teams...

Question: modify the method so that instead of manually making teams...

Question details

Modify the method so that instead of manually making teams, it reads it from a text file called TeamsList.txt. Everything must be done in this method.

public void make_test_teams() {
List<Team> teams = new ArrayList<Team>();

Player burns = new Player("George Burns", "George");
Player allen = new Player("Gracie Allen", "Gracie");
List<Player> ba = new ArrayList<Player>();
ba.add(burns); ba.add(allen);
Team burns_and_allen = new Team("Burns and Allen", ba);

Player abbott = new Player("William Abbott", "Bud");
Player costello = new Player("Louis Cristillo", "Lou");
List<Player> ac = new ArrayList<Player>();
ac.add(abbott); ac.add(costello);
Team abbott_and_costello = new Team("Abbott and Costello", ac);

Player chico = new Player("Leonard Marx", "Chico");
Player groucho = new Player("Julius Marx", "Groucho");
Player harpo = new Player("Adolph Marx", "Harpo");
List<Player> mb = new ArrayList<Player>();
mb.add(chico); mb.add(groucho); mb.add(harpo);
Team marx_brothers = new Team("Marx Brothers", mb);


the text file looks like

team: "Burns and Allen"
player: fullname: George Burns, nickname: George
player: fullname: Gracie Allen, nickname: Gracie

team: "Abbott and Costello"
player: fullname: William Abbott, nickname: Bud
player: fullname: Louis Cristillo, nickname: Lou

team: "Marx Brothers"
player: fullname: Leonard Marx, nickname: Chico
player: fullname: Julius Marx, nickname: Groucho
player: fullname: Adolph Marx, nickname: Harpo

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution