public static CashSuper CreateCashFactory(string CalculateString) { CashSuper CashSuperBuffer = null; switch (CalculateString) { case "Normal": CashSuperBuffer = new CashNormal(); break; case "10% off": CashOFF co = new CashOFF("0.9"); CashSuperBuffer = co; break; case "20% off": CashOFF co1 = new CashOFF("0.8"); CashSuperBuffer = co1; break; } return(CashSuperBuffer); }
//现金收费工厂 public static CashSuper CreateCashAccept(string type) { CashSuper cs = null; switch (type) { case "正常收费": cs = new CashNormal(); break; case "满300返100": cs = new CashReturn("300", "100"); break; case "打八折": cs = new CashRebate("8"); break; case "打七折": cs = new CashRebate("7"); break; case "打五折": cs = new CashRebate("5"); break; } return cs; }