Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
            }
        }