All pastes #2070458 Raw Edit

Miscellany

public text v1 · immutable
#2070458 ·published 2011-05-27 15:35 UTC
rendered paste body
import java.util.ArrayList;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Jacob's Games Store
 */
public class GameShop
{
    // instance variables
    private ArrayList<Game> game;

    /**
     * Constructor for objects of class GameShop
     */
    public GameShop()
    {
        // initialise instance variables
        game = new ArrayList<Game>();
    }

    /**
     * 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(); }
    }
            
}