core: import java.lang.*; import java.io.*; import edu.neu.ccs.demeter.dj.*; import java.util.*; import edu.neu.ccs.demeter.*; add: abstract class Rating { public constructor Rating() {{ super(); }} {{ private static HashMap subclassMap = null; //holds objects of all subclasses of Rating }} private static void setUpSubclassMap() {{ /* populates the subclass table */ subclassMap = new HashMap(); subclassMap.put("C0", new C0()); subclassMap.put("C1", new C1()); subclassMap.put("C9", new C9()); subclassMap.put("D0", new D0()); subclassMap.put("D1", new D1()); subclassMap.put("D3", new D3()); subclassMap.put("D4", new D4()); }} public static Rating prompt(String prompt) {{ /* This function will get a rating entered by the user input: prompt - a string to prompt the user output: a new Rating object */ Rating returnRating = null; //Rating to be returned String tempRating = Main.promptString(prompt + " [C0][C1][C9][D0][D1][D3][D4]"); if ((tempRating != "C0") && (tempRating != "C1") && (tempRating != "C9") && (tempRating != "D0") && (tempRating != "D1") && (tempRating != "D3") && (tempRating != "D4")){ System.out.println("invalid rating entered, C0 will be used"); tempRating = "C0"; } if (subclassMap == null) setUpSubclassMap(); returnRating = (Rating) subclassMap.get(tempRating); return returnRating; }} {{ void universal_trv0_bef(UniversalVisitor _v_) { ((UniversalVisitor) _v_).before(this); } }} {{ void universal_trv0_aft(UniversalVisitor _v_) { ((UniversalVisitor) _v_).after(this); } }} {{ void universal_trv0(UniversalVisitor _v_) { } }} {{ void everything_Bank_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } }} {{ void everything_Bank_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } }} {{ void everything_Bank_trv(PrintVisitor __v0) { } }} {{ void __trav_print_Bank_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } }} {{ void __trav_print_Bank_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } }} {{ void __trav_print_Bank_trv(PrintVisitor __v0) { } }} {{ void __trav_display_Bank_trv_bef(DisplayVisitor __v0) { ((UniversalVisitor) __v0).before(this); } }} {{ void __trav_display_Bank_trv_aft(DisplayVisitor __v0) { ((UniversalVisitor) __v0).after(this); } }} {{ void __trav_display_Bank_trv(DisplayVisitor __v0) { } }} {{ void __trav_viewParty_Party_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } }} {{ void __trav_viewParty_Party_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } }} {{ void __trav_viewParty_Party_trv(PrintVisitor __v0) { } }} }