Question: Modify the method so that instead of manually making teams, it reads it from a text file called TeamsList.txt. public void make_test_teams() { List teams
Modify the method so that instead of manually making teams, it reads it from a text file called TeamsList.txt.
public void make_test_teams() { List teams = new ArrayList(); Player burns = new Player("George Burns", "George"); Player allen = new Player("Gracie Allen", "Gracie"); List ba = new ArrayList(); ba.add(burns); ba.add(allen); Team burns_and_allen = new Team("Burns and Allen", ba); teams.add(burns_and_allen); Player abbott = new Player("William Abbott", "Bud"); Player costello = new Player("Louis Cristillo", "Lou"); List ac = new ArrayList(); ac.add(abbott); ac.add(costello); Team abbott_and_costello = new Team("Abbott and Costello", ac); teams.add(abbott_and_costello); Player chico = new Player("Leonard Marx", "Chico"); Player groucho = new Player("Julius Marx", "Groucho"); Player harpo = new Player("Adolph Marx", "Harpo"); List mb = new ArrayList(); mb.add(chico); mb.add(groucho); mb.add(harpo); Team marx_brothers = new Team("Marx Brothers", mb); teams.add(marx_brothers); store_teams(teams); }
text file looks like this
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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
