public ISweepStakesManager CreatingMarketingFirmWithManager() { Console.WriteLine("Would you prefer stack or queue to manage the sweepstakes. "); string value = Console.ReadLine(); ISweepStakesManager manager = null; if (value == "Stack") { manager = new SweepStakesStackManager(); } else if (value == "queue") { manager = new SweepStakesQueueManager(); } return(manager); }
static void Main(string[] args) { MarketingFirm marketingFirm; SweepstakesQueueManager sweepstakesQueueManager = new SweepstakesQueueManager(); SweepStakesStackManager sweepStakesStackManager = new SweepStakesStackManager(); Contestant firstContestant = new Contestant(); Contestant secondContestant = new Contestant(); Contestant thirdContestant = new Contestant(); SweepStakes sweepStakes1 = new SweepStakes("Bucks"); SweepStakes sweepStakes2 = new SweepStakes("Packers"); sweepStakes1.RegisterContestant(firstContestant); sweepStakes1.RegisterContestant(secondContestant); sweepStakes1.RegisterContestant(thirdContestant); sweepStakes1.PrintContestantInfo(); sweepStakes2.RegisterContestant(firstContestant); sweepStakes2.RegisterContestant(secondContestant); sweepStakes2.PrintContestantInfo(); string input = UserInterfacecs.GetString("Do you want to use queue or stack manager?"); input.ToLower(); switch (input) { case "queue": sweepstakesQueueManager.InsertSweepStakes(sweepStakes1); sweepstakesQueueManager.InsertSweepStakes(sweepStakes2); marketingFirm = new MarketingFirm(sweepstakesQueueManager); break; case "stack": sweepStakesStackManager.InsertSweepStakes(sweepStakes1); sweepStakesStackManager.InsertSweepStakes(sweepStakes2); marketingFirm = new MarketingFirm(sweepStakesStackManager); break; default: break; } }
public ISweepStakesManager GetManager(string type) { ISweepStakesManager user = null; switch (type) { case "Stack": user = new SweepStakesStackManager(); break; case "Queue": user = new SweepStakesQueueManager(); break; default: Console.WriteLine("Not a valid role"); GetManager(type); break; } return(user); }
void CreateMarketingFirmWithManager() { ISweepStakesManaager manager; switch (UserInterface.GetUserInput("Choose Your Manager: Stack or Queue.").ToLower()) { case "stack": manager = new SweepStakesStackManager(); MarketingFirm Mf = new MarketingFirm(manager); break; case "queue": manager = new SweepStakesQueueManager(); Mf = new MarketingFirm(manager); break; default: CreateMarketingFirmWithManager(); break; } }
public static ISweepStakesManager GetChoiceOfManager() { string choice = UserInterface.GetUserInputFor("What kind of manager would you like to hold all of your Sweepstakes?\nType 1 for a Stack.\nType 2 for a Queue."); while (true) { if (choice == "1") { SweepStakesStackManager sweepStakesStackManager = new SweepStakesStackManager(); return(sweepStakesStackManager); } else if (choice == "2") { SweepStakesQueueManager sweepStakesQueueManager = new SweepStakesQueueManager(); return(sweepStakesQueueManager); } else { Console.WriteLine("Invalid option, select again."); } } }
public void CreateMarketingFirm() { int input; Console.WriteLine("Press 1 for Stack management type. "); Console.WriteLine("Press 2 for Queue management style. "); input = int.Parse(Console.ReadLine()); ISweepStakesManager manager = null; if (input == 1) { manager = new SweepStakesStackManager(); } else if (input == 2) { manager = new SweepStakesQueueManager(); } else { Console.WriteLine("Please enter a valid input. "); CreateMarketingFirm(); } MarketingFirm marketingFirm = new MarketingFirm(manager); }
public MarketingFirm(string stackorqueue) //string here for using stack or queue { ISweepstakesManager sweepstakesManager; switch (stackorqueue) { case "queue": sweepstakesManager = new SweepStakesQueueManager(); break; case "stack": sweepstakesManager = new SweepStakesStackManager(); break; default: return; } int choice = 0; int killSwitch = 1; while (choice != killSwitch) { choice = UI.promptForOptions("Would you like to Add another sweepStakes?", new List <string>() { "yes", "no" }); if (choice == 0) { Console.Write("Enter the name of the SweepStakes: "); string name = Console.ReadLine(); sweepstakesManager.SweepStakes(name); } } choice = 0; do { SweepStakes currentSweepStakes = sweepstakesManager.GetSweepStakes(); while (choice != killSwitch) { Console.WriteLine($"Registering Contestants for: {currentSweepStakes.name}"); choice = UI.promptForOptions("Enter another Contestant?", new List <string>() { "yes", "no" }); if (choice == 0) { Console.Write("First Name: "); string firstName = Console.ReadLine(); Console.Write("Last Name: "); string lastName = Console.ReadLine(); Console.Write("Email: "); string email = Console.ReadLine(); currentSweepStakes.registerContestant(new Contestant(firstName, lastName, email)); } if (choice == 1) { pickWinner(currentSweepStakes); } } } while (sweepstakesManager != null); }