
/**
 *  Using arrays 
 * 
 *
 * @author Kathryn
 * @version February 2007
 * 
 * 1) Declare an array of integers for the inventory tracking
 * 2) Array of strings for the names
 * 3) Initialize both
 * 4) Print them out
 * 
 * 5) Motivate that this structure is not the best and that we
 *    would probably like an array that links the name and inventory
 *    together --- go over other array drawbacks (in power point)
 */
public class Inventory
{
    public static void main(String[] args)
    {
        int[] inventory = new int[4];
        String[] appleNames = new String[4];
        
        appleNames[0] = "Grapple";
        inventory[0] = 0;
        appleNames[1] = "Red Delicious";
        inventory[1] = 30;
        appleNames[2] = "Fuji";
        inventory[2] = 100;
        appleNames[3] = "Gala";
        inventory[3] = 27;
        
        inventory[1] = inventory[1] - 6;
        inventory[3] -= 4;
        
        int max = 0;  // the index of the maximum apple inventory
        for (int i = 0; i < inventory.length; i++) {
          System.out.println(inventory[i] + " apples of type " + appleNames[i] + ".");   
          if (inventory[max] < inventory[i]) {
              max = i;
            }
        }
        System.out.println("The largest inventory is " + inventory[max] 
            + " of apples of type " + appleNames[max]);
        
        
        
    }
}
