import java.util.*;
import java.io.*;
/**
 *  Inventory class uses arrays to track multiple types of products
 *
 * @author Kathryn
 * @version February 2007
 * 
 * Today: 
 * 1) Use static and regular methods
 * 
 */


public class Inventory
{
    public static void main(String[] args) throws Exception
    {
        // Make an array of two items & a Scanner
        Scanner stdin = new Scanner (System.in);

        
        // File format: first tells us the number of different Items
        // Each name and amount are on a line by themselves
        
        System.out.print("Enter the input file name: ");
        Scanner gFile = new Scanner(new File(stdin.nextLine()));
        
        int size = gFile.nextInt();
        gFile.nextLine();
        Items[] apples = new Items[size];
        
        // Read in two new items
        for (int i = 0; i < apples.length; ++i) {
            String aName = Items.getName(gFile, "apples");
            int amount = Items.getPositiveInteger(gFile, aName);
            apples[i] = new Items(aName, amount);
        }
 
        // Print them out 
        for (int i = 0; i < apples.length; i++) {
            System.out.println(apples[i].toString());
            
        }

        
    }
}
