why wont this class print?
package holidaycelebrations; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner;
/** * * @author */ public class HolidayCelebrations {
public static void main(String[] args) throws IOException { ArrayList myFamilyTraditions = createTraditions(); celebrateHolidays(myFamilyTraditions); } public static ArrayList createTraditions() throws IOException { //arrayList that hold the objects of granparents,parents and children ArrayList myFamilyTraditions = new ArrayList<>(); File aFile = new File("holidays.txt"); Scanner inFile = new Scanner(aFile); //variables to hold data from file GrandparentsTradition aGrandParent; ParentsTradition aParent; ChildrenTradition aChild; String typeRecord; //grandparent String holidayName; String holidaySeason; String timeOfDayCelebration; String mainDishName; int numberOfSideDishes; String locationOfGathering; double costOfMeal; String mealSource; //parent int numberInvited ; String traditionalDessert ; String traditionalDrink ; double costPerDessert ; double costPerDrink ; //children String holidayGame ; String holidayStorybook ; String holidayMovie ; double costOfMovie ; while (inFile.hasNext()) { typeRecord=inFile.nextLine(); if (typeRecord.equals("g")){ holidayName=inFile.nextLine(); holidaySeason=inFile.nextLine(); timeOfDayCelebration=inFile.nextLine(); mainDishName=inFile.nextLine(); numberOfSideDishes = inFile.nextInt(); locationOfGathering=inFile.nextLine(); costOfMeal=inFile.nextDouble(); mealSource=inFile.nextLine(); aGrandParent = new GrandparentsTradition(holidayName,holidaySeason,timeOfDayCelebration,mainDishName, numberOfSideDishes,locationOfGathering,costOfMeal,mealSource); myFamilyTraditions.add(aGrandParent); } else if (typeRecord.equals("p")){ holidayName=inFile.nextLine(); holidaySeason=inFile.nextLine(); timeOfDayCelebration=inFile.nextLine(); mainDishName=inFile.nextLine(); numberOfSideDishes = inFile.nextInt(); locationOfGathering=inFile.nextLine(); costOfMeal=inFile.nextDouble(); mealSource=inFile.nextLine(); numberInvited=inFile.nextInt(); traditionalDessert=inFile.nextLine(); traditionalDrink=inFile.nextLine(); costPerDessert=inFile.nextDouble(); costPerDrink=inFile.nextDouble(); aParent= new ParentsTradition(holidayName,holidaySeason,timeOfDayCelebration,mainDishName,numberOfSideDishes,locationOfGathering,costOfMeal,mealSource,numberInvited,traditionalDessert, traditionalDrink,costPerDessert,costPerDrink); myFamilyTraditions.add(aParent); } else if (typeRecord.equals("c")){ holidayName=inFile.nextLine(); holidaySeason=inFile.nextLine(); timeOfDayCelebration=inFile.nextLine(); mainDishName=inFile.nextLine(); numberOfSideDishes = inFile.nextInt(); locationOfGathering=inFile.nextLine(); costOfMeal=inFile.nextDouble(); mealSource=inFile.nextLine(); numberInvited=inFile.nextInt(); traditionalDessert=inFile.nextLine(); traditionalDrink=inFile.nextLine(); costPerDessert=inFile.nextDouble(); costPerDrink=inFile.nextDouble(); holidayGame=inFile.nextLine(); holidayStorybook=inFile.nextLine(); holidayMovie=inFile.nextLine(); costOfMovie=inFile.nextDouble(); aChild= new ChildrenTradition(holidayName,holidaySeason,timeOfDayCelebration,mainDishName,numberOfSideDishes,locationOfGathering,costOfMeal,mealSource,numberInvited,traditionalDessert, traditionalDrink,costPerDessert,costPerDrink,holidayGame, holidayStorybook,holidayMovie,costOfMovie); myFamilyTraditions.add(aChild); } } inFile.close(); return myFamilyTraditions; } public static void celebrateHolidays(ArrayList myFamilyTraditions) { for (int i = 0; i < myFamilyTraditions.size(); i++) { System.out.println(myFamilyTraditions.get(i).celebrate() +myFamilyTraditions.get(i).tabulateCosts()); } }
}