import java.util.ArrayList; import java.io.FileWriter; import java.io.IOException; /** * Jacob's Games Store */ public class GameShop { // instance variables private ArrayList game; /** * Constructor for objects of class GameShop */ public GameShop() { // initialise instance variables game = new ArrayList(); } /** * Add a game to the store */ public void addGame(Game newGame) { game.add(newGame); } /** * Write Platform File */ public void writePlatformFile(String pplatform) { try { FileWriter fw = new FileWriter(pplatform); for (int index = 0; index < game.size(); index++) { if (pplatform.equals(pplatform.equals(game.get(index).platform) == true)) { game.get(index).write(fw); } } fw.close(); } catch (IOException e){ e.printStackTrace(); } } }