예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        //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;
            }
        }
예제 #4
0
        //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();
            }
        }
예제 #5
0
        //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());
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        //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;
            }
        }
예제 #8
0
        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);
            }
        }