public static ISweepstakesManager ChooseSweepstakesManager(string choice) { ISweepstakesManager sweepstakesManager = null; switch (choice) { case "queue": sweepstakesManager = new SweepstakesQueueManager(); break; case "stack": sweepstakesManager = new SweepstakesStackManager(); break; default: break; } return(sweepstakesManager); }
public static ISweepstakesManager SelectSweepstakesManager(string managerType) { ISweepstakesManager manager = null; switch (managerType) { case "Stack": manager = new SweepstakesStackManager(); break; case "Queue": manager = new SweepstakesQueueManager(); break; default: Console.WriteLine("Not a valid manager type."); break; } return(manager); }
//Member Variables (HAS A) //Constructor //Member Methods (CAN DO) public void CreateMarketingFirmWithManager() { ISweepstakesManager _manager; switch (UserInterface.GetDataStructurePreference()) { case "queue": _manager = new SweepstakesQueueManager(); break; case "stack": _manager = new SweepstakesStackManager(); break; default: Console.WriteLine("Not a valid option. Please choose again"); CreateMarketingFirmWithManager(); break; } }
//set up menu //set up stack and queue managers // public void ChooseStructureOption() { Console.WriteLine("Would you like to use Stack or Queue data structure for your sweepstake?"); userInput = Console.ReadLine(); if (userInput == "Stack") { SweepstakeStackManager stackManager = new SweepstakeStackManager(); } else if (userInput == "Queue") { SweepstakesQueueManager queueManager = new SweepstakesQueueManager(); } else { Console.WriteLine("Please enter 'Stack' or 'Queue' for valid response"); ChooseStructureOption(); } }
//member methods public MarketingFirm CreateMarketingFirmWithManager() ///factory design pattern; using user input to determine what type of manager object to use/create { string managerType = UserInterface.GetManagerType(); switch (managerType.ToLower()) { case "queue": case "queue manager": SweepstakesQueueManager manager = new SweepstakesQueueManager(); return(new MarketingFirm(manager)); case "stack": case "stack manager": SweepstakesStackManager _manager = new SweepstakesStackManager(); return(new MarketingFirm(_manager)); default: Console.WriteLine("Not valid"); return(CreateMarketingFirmWithManager()); } }
public ISweepStakesManager CreateSweepstakes(string sweepstakes) { ISweepStakesManager user = null; switch (sweepstakes) { case "Queue": user = new SweepstakesQueueManager(); break; case "Stack": user = new SweepstakesStackManager(); break; default: Console.WriteLine("Please choose a valid option."); CreateSweepstakes(sweepstakes); break; } return(user); }
//member methods (CAN DO) public void CreateMarketingFirmWithManager() { ISweepstakesManager sweepstakesManager; MarketingFirm marketingFirm; UserInterface.PromptUser("What manager type would you like to create (queue or stack)?"); string managerType = Console.ReadLine(); switch (managerType) { case "queue": sweepstakesManager = new SweepstakesQueueManager(); marketingFirm = new MarketingFirm(sweepstakesManager); break; case "stack": sweepstakesManager = new SweepstakesStackManager(); marketingFirm = new MarketingFirm(sweepstakesManager); break; } }
public static ISweepstakesManager GetMarketingFirmStorageStyle() { Console.WriteLine("Would you like to use a stack or Queue for your sweepstakes"); string style = Console.ReadLine().ToLower().Trim(); if (style == "queue") { SweepstakesQueueManager myStyle = new SweepstakesQueueManager(); return(myStyle); } else if (style == "stack") { SweepstakesStackManager myStackStyle = new SweepstakesStackManager(); return(myStackStyle); } else { Console.WriteLine("please enter stack or queue."); GetMarketingFirmStorageStyle(); SweepstakesStackManager myStackStyle = new SweepstakesStackManager(); return(myStackStyle); } }