public static ISweepstakesManager FactoryDecider()
 {
     ISweepstakesManager manager;
     string choice = UserInterface.GetManagerOption();
     if (choice == "stack")
     {
         manager = new SweepstakesStackManager();
         return manager;
     }
     else if (choice == "queue")
     {
         manager = new SweepstakesQueueManager();
         return manager;
     }
     else
     {
         Console.WriteLine("Not a valid option.");
         return FactoryDecider();
     }
 }
Пример #2
0
        public static ISweepstakesManager ManagerFactory(string choice)
        {
            ISweepstakesManager _manager = null;

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

            case "queue":
                _manager = new SweepstakesQueueManager();
                break;

            default:
                Console.WriteLine("Please choose a valid Option");
                ManagerFactory(choice);
                break;
            }
            return(_manager);
        }
Пример #3
0
        public static ISweepstakesManager PickManager()
        {
            ISweepstakesManager pickManager;
            string pick;

            do
            {
                Console.WriteLine("How would you like your sweepstakes to be managed? stack or queue?");
                pick = Console.ReadLine().ToLower();
            }while (pick != "stack" && pick != "queue");
            if (pick == "stack")
            {
                pickManager = new SweepstakesStackManager();
                return(pickManager);
            }
            else if (pick == "queue")
            {
                pickManager = new SweepstakesQueueManager();
                return(pickManager);
            }
            return(null);
        }
Пример #4
0
        public static ISweepstakesManager GetManager()
        {
            string userInput;
            ISweepstakesManager manager;

            Console.WriteLine("What kind of manager would you like to create?\n[1]Stack\n[2]Queue");
            userInput = Console.ReadLine();
            switch (userInput)
            {
            case "1":
                manager = new SweepstakesStackManager();
                break;

            case "2":
                manager = new SweepstakesQueueManager();
                break;

            default:
                DisplayErrorMessage();
                return(GetManager());
            }
            return(manager);
        }
Пример #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("would you like to use a stack or queue to store your sweepstakes?");
            string userInput = Console.ReadLine();
            ISweepstakesManager sweepStakesManager;


            switch (userInput)
            {
            case "queue":
                sweepStakesManager = new SweepstakesQueueManager();
                MarketingFirm MFQ = new MarketingFirm(sweepStakesManager);
                break;

            case "stack":
                sweepStakesManager = new SweepstakesStackManager();
                MarketingFirm MFS = new MarketingFirm(sweepStakesManager);
                break;

            default:
                break;
            }
        }