public class ItemTable {
private final Integer[] idT = { 1,2,3,4,5,6,7,8,9,10 };
private final Integer[] quantityT = { 1,2,3,4,5,6,7,8,9,10 };
private final String[] barcodeT = { "001" , "002", "003", "004", "005",null,null,null,null,null, };
private final String[] nameT =  { "Milk", "Bread", "Wine", "Butter", "Potato", "Sweet Potato","Ginger" ,"Avacado", "Cucumber"};
private final double[] perWeightT = {0.2,0.4,0.1,0.2,0.1,2,1,0.5,0,0,0};
private final double[] perPriceT = { 1.50, 2.45, 12.95, 4.75, 2, 3.5, 12, 4, 3, 1 };
private final ArrayList<ItemType> table = new ArrayList<>();
public final ArrayList<View> lookUpItem = new ArrayList<>();
public ItemTable()
{
    for(int i = 0; i< idT.length; i++)
    {
        if(barcodeT[i]!=null)
            table.add(new ItemTypeB (idT[i], nameT[i], perPriceT[i],perWeightT[i],barcodeT[i]));
        else 
        {   
            if(perWeightT[i]!=0)
            {    
                table.add( new ItemTypeW(idT[i], nameT[i], perPriceT[i],perWeightT[i],perWeightT[i]));
                lookUpItem.add( new View(idT[i], nameT[i], "w"));
            }
            if(perWeightT[i]==0) 
            {
                table.add( new ItemTypeC(idT[i], nameT[i], perPriceT[i],perWeightT[i], quantityT[i] ));
                lookUpItem.add( new View(idT[i], nameT[i], "c"));
            }
        }
    }
}
The problem area is specifically at table.add(new ItemTypeC) around the last line of code.
 
     
     
    