public static string ManagerChoice(string choice) //factory design video -Michael to reference this, switch case for ManagerChoice, parameter is the string choice
        {
            ISweepStakesManager _manager;                 // inherit sweepstake

            switch (choice)
            {
            case "Stack":
                _manager = new SweepstakesStackManager();
                break;

            case "Queue":
                _manager = new SweepstakeQueueManager();
                break;

            default:
                Console.WriteLine("Not a valid choice, choose either Stack or Queue");
                break;
            }
            return(choice);
        }
Beispiel #2
0
        public static void ChooseDataStructure()
        {
            Console.WriteLine("Please type if you would like to pull sweepstakes from a stack or queue.");
            string userInput = Console.ReadLine().ToLower();

            switch (userInput)
            {
            case "stack":
                SweepstakeStackManager newStack = SweepstakesFactory.CreateStack();
                break;

            case "queue":
                SweepstakeQueueManager newQueue = SweepstakesFactory.CreateQueue();
                break;

            default:
                Console.WriteLine("incorrect input, please try again.");
                ChooseDataStructure();
                break;
            }
        }