Exemple #1
0
    {// member variables (HAS A)
     // constructor
     // member methods (CAND DO)
        public ISweepstakesManager DetermineManager(string answer)
        {
            ISweepstakesManager sweepstakesManager;

            switch (answer)
            {
            case "stack":
                SweepstakesStackManager sweepstakesStackManager = new SweepstakesStackManager();
                sweepstakesManager = sweepstakesStackManager;
                break;


            case "queue":

                SweepstakesQueueManager sweepstakesQueueManager = new SweepstakesQueueManager();
                sweepstakesManager = sweepstakesQueueManager;
                break;


            default:

                UserInterface.DisplayWrongInput();
                string tryagain = UserInterface.AskQueueOrStack();
                sweepstakesManager = DetermineManager(tryagain);
                break;
            }

            return(sweepstakesManager);
        }
Exemple #2
0
        public static ISweepstakesManager GetMarketingFirmStylePreference()
        {
            Console.WriteLine("Thank you for starting the Sweepstakes Application!Follow instructions as they appear");
            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("Would you like the system to be set up in a stack or queue style? Please select 'stack' or 'queue'.");
            string style = Console.ReadLine().ToString().Trim();

            if (style == "stack")
            {
                SweepstakesStackManager stackStyle = new SweepstakesStackManager();
                return(stackStyle);
            }
            else if (style == "queue")
            {
                SweepstakesQueueManager queueStyle = new SweepstakesQueueManager();
                return(queueStyle);
            }
            else
            {
                Console.WriteLine("Please follow directions and enter a valid input");
                Console.ReadLine();
                return(GetMarketingFirmStylePreference());
            }
        }
        public void CreateMarketingFirmWithManager()
        {
            SweepstakesStackManager Stack = new SweepstakesStackManager();
            MarketingFirm           firm  = new MarketingFirm(Stack);

            firm.CreateSweepstake();
        }
Exemple #4
0
        //parameter for function
        public static ISweepstakesManager CreateManager()
        {
            Console.WriteLine("Would you like to use a stack or a queue for your sweepstakes?");
            Console.WriteLine("Please enter 'stack', or 'queue'");
            string managerType          = Console.ReadLine();
            ISweepstakesManager manager = null;

            switch (managerType)
            {
            case "stack":
                Console.WriteLine("You have chosen to stack.");
                manager = new SweepstakesStackManager();
                break;

            case "queue":
                Console.WriteLine("You have chosen to queue.");
                manager = new SweepstakesQueueManager();
                break;

            default:
                Console.WriteLine("Please enter 1 for stack or 2 for queue.");
                CreateManager();
                break;
            }
            return(manager);
        }
        public static ISweepstakesManager ChooseStackOrQueue()
        {
            ISweepstakesManager chosenManager = null;
            string stackOrQueue;

            Console.WriteLine("What manager to use? \na) stack \nb) queue");
            stackOrQueue = Console.ReadLine();
            switch (stackOrQueue.ToLower())
            {
            case "a":
                SweepstakesStackManager stackManager = new SweepstakesStackManager();
                chosenManager = stackManager;
                break;

            case "b":
                SweepstakesQueueManager queueManager = new SweepstakesQueueManager();
                chosenManager = queueManager;
                break;

            default:
                Console.WriteLine("Invalid input.");
                break;
            }
            return(chosenManager);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            SweepstakesStackManager sweepstakesStackManager = new SweepstakesStackManager();
            SweepstakesQueueManager sweepstakesQueueManager = new SweepstakesQueueManager();

            Console.WriteLine("Welcome to Sweepstakes!");
            Console.WriteLine();
            Sweepstakes sweepstakes = new Sweepstakes("State Fair Tickets!");

            Console.WriteLine("Today's Sweepstake Give Away is: " + "'" + sweepstakes.name + "'");
            Console.WriteLine();

            sweepstakes.CreatePlayers(sweepstakes);

            sweepstakesQueueManager.InsertSweepstakes(sweepstakes);
            Console.WriteLine("From the Queue");
            sweepstakes.RunSweepstakes(sweepstakesQueueManager);
            Console.WriteLine();

            sweepstakesStackManager.InsertSweepstakes(sweepstakes);
            Console.WriteLine("From the Stack");
            sweepstakes.RunSweepstakes(sweepstakesStackManager);

            Console.ReadLine();
        }
        public static ISweepstakesManager GetManagerType()
        {
            Console.WriteLine("Which flavor of sweepstakes manager would you like?\n" +
                              "Stack or Queue?");
            ISweepstakesManager managerType = null;
            string tempManager = Console.ReadLine();

            switch (tempManager)
            {
            case "Stack":
                managerType = new SweepstakesStackManager();
                break;

            case "stack":
                managerType = new SweepstakesStackManager();
                break;

            case "Queue":
                managerType = new SweepstakesQueueManager();
                break;

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

            default:
                Console.WriteLine("Not a valid manager type");
                GetManagerType();
                break;
            }
            return(managerType);
        }
        public static ISweepstakesManager SetManagerType(string managerTypeIn)
        {
            managerTypeIn = UserInterface.SetManagerType(managerTypeIn);
            ISweepstakesManager manager = null;

            switch (managerTypeIn)
            {
            case ("stack"):
            {
                manager = new SweepstakesStackManager();
                break;
            }

            case ("queue"):
            {
                manager = new SweepstakesQueueManager();
                break;
            }

            default:
            {
                break;
            }
            }

            return(manager);
        }
        public void InsertSweepstakes(Sweepstakes sweepstakes)
        {
            Console.WriteLine("Please choose \"Stack\" or \"Queue\" management for your sweepstakes");
            string value = Console.ReadLine();

            value = value.ToLower();
            switch (value)
            {
            case "stack":
            {
                sweepstakesStackManager = new SweepstakesStackManager();
                sweepstakesStackManager.InsertSweepstakes(sweepstakes);
                break;
            }

            case "queue":
            {
                sweepstakesQueueManager = new SweepstakesQueueManager();
                sweepstakesQueueManager.InsertSweepstakes(sweepstakes);
                break;
            }

            default:
            {
                Console.WriteLine("Please enter a valid response. \"Stack\" or \"Queue\"");
                InsertSweepstakes(sweepstakes);
                break;
            }
            }
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Contestant jimmy   = new Contestant("Jimmy", "Neutron", "123@fakedotcom", "1");
            Contestant anna    = new Contestant("Anna", "Nicole", "*****@*****.**", "2");
            Contestant john    = new Contestant("John", "Neeappleseed", "john@fakedotcom", "3");
            Contestant tom     = new Contestant("Tom", "Tomdrum", "*****@*****.**", "4");
            Contestant tim     = new Contestant("Tim", "Thetoolmantaylor", "tim@fakedotcom", "5");
            Contestant marypat = new Contestant("Mary Pat", "Down", "*****@*****.**", "6");

            List <Contestant> contestantList = new List <Contestant>()
            {
                jimmy, anna, john, tom, tim, marypat
            };

            foreach (Contestant person in contestantList)
            {
                RegisterContestant(person);
            }

            SweepstakesQueueManager queueManager = new SweepstakesQueueManager();
            SweepstakesStackManager stackManager = new SweepstakesStackManager();

            //foreach (Sweepstakes sweepstakes in listOfSweepstakes)
            //{
            //    queueManager.InsertSweepstakes(sweepstakes);
            //}

            //foreach (Sweepstakes sweepstakes in listOfSweepstakes)
            //{
            //    stackManager.InsertSweepstakes(sweepstakes);
            //}
        }
        static void Main(string[] args)
        {
            SweepstakesStackManager stack       = new SweepstakesStackManager();
            SweepstakesQueueManager queue       = new SweepstakesQueueManager();
            List <Contestant>       contestantN = new List <Contestant>();



            Console.ReadLine();
        }
Exemple #12
0
 void SelectManagerType(string selection)
 {
     if (selection == "queue")
     {
         SweepstakesQueueManager manager = new SweepstakesQueueManager();
     }
     else if (selection == "stack")
     {
         SweepstakesStackManager manager = new SweepstakesStackManager();
     }
 }
Exemple #13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Do you want a que or a stack?");

            SweepstakesQueueManager thing  = new SweepstakesQueueManager();
            SweepstakesStackManager thing2 = new SweepstakesStackManager();

            Console.ReadLine();
            Simulation sim1 = new Simulation();

            sim1.RunMain();
            Console.ReadLine();
        }
Exemple #14
0
        static void Main(string[] args)
        {
            SweepstakesQueueManager queueSweeps = new SweepstakesQueueManager();
            Sweepstakes             sweeps1     = queueSweeps.GetNextSweepstakesWinner();

            queueSweeps.InsertSweepstakes(sweeps1);

            SweepstakesStackManager stackSweeps = new SweepstakesStackManager();
            Sweepstakes             sweeps2     = stackSweeps.GetNextSweepstakesWinner();

            stackSweeps.InsertSweepstakes(sweeps2);
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Sweepstakes             sweepstakes = new Sweepstakes();
            Contestant              contestant  = new Contestant();
            SweepstakesQueueManager Queue       = new SweepstakesQueueManager();
            SweepstakesStackManager Stack       = new SweepstakesStackManager();


            MarketingFirm marketingFirm = new MarketingFirm(Stack);



            sweepstakes.RegisterContestant(contestant);
        }
Exemple #16
0
        static void Main(string[] args)
        {
            SweepstakesStackManager stackManager = new SweepstakesStackManager();
            SweepstakesQueueManager queueManager = new SweepstakesQueueManager();

            Sweepstakes sweepstakes = new Sweepstakes("Packers Ticket Giveaway");

            queueManager.InsertSweepstakes(sweepstakes);
            stackManager.InsertSweepstakes(sweepstakes);
            Console.WriteLine("Please enter at least two contestants for the " + sweepstakes.sweepstakesName + ".");
            Console.ReadLine();
            Contestant contestant = sweepstakes.CreateContestant();

            sweepstakes.RegisterContestant(contestant);
            sweepstakes.CreateContestant();
            sweepstakes.RegisterContestant(contestant);

            sweepstakes = new Sweepstakes("Brewers Ticket Giveaway");
            queueManager.InsertSweepstakes(sweepstakes);
            stackManager.InsertSweepstakes(sweepstakes);
            Console.WriteLine("Please enter at least two contestants for the " + sweepstakes.sweepstakesName + ".");
            Console.ReadLine();
            sweepstakes.CreateContestant();
            sweepstakes.RegisterContestant(contestant);
            sweepstakes.CreateContestant();
            sweepstakes.RegisterContestant(contestant);


            sweepstakes = new Sweepstakes("Bucks Ticket Giveaway");
            queueManager.InsertSweepstakes(sweepstakes);
            stackManager.InsertSweepstakes(sweepstakes);
            Console.WriteLine("Please enter at least two contestants for the " + sweepstakes.sweepstakesName + ".");
            Console.ReadLine();
            sweepstakes.CreateContestant();
            sweepstakes.RegisterContestant(contestant);
            sweepstakes.CreateContestant();
            sweepstakes.RegisterContestant(contestant);

            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(sweepstakes.sweepstakesName);
                Console.WriteLine("Queue Manager:");
                RunSweepstakes(queueManager);
                Console.WriteLine("Stack Manager:");
                RunSweepstakes(stackManager);
                Console.WriteLine();
            }
            Console.ReadLine();
        }
Exemple #17
0
        public static ISweepstakesManager CreateManager(string type)
        {
            ISweepstakesManager manager = null;

            switch (type)
            {
            case "stack":
                manager = new SweepstakesStackManager();
                break;

            case "queue":
                manager = new SweepstakesQueueManager();
                break;
            }
            return(manager);
        }
        public ISweepstakesManager GenerateSweepstakesManager(string choice)
        {
            switch (choice)
            {
            case "Queue":
                SweepstakesQueueManager queueManager = new SweepstakesQueueManager();
                return(queueManager);

            case "Stack":
                SweepstakesStackManager stackManager = new SweepstakesStackManager();
                return(stackManager);

            default:
                throw new ApplicationException(string.Format("Not a valid manager"));
            }
        }
Exemple #19
0
        public static ISweepstakesManager AssignManager(string managementChoice)
        {
            ISweepstakesManager _manager = null;

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

            case "stack":
                _manager = new SweepstakesStackManager();
                break;
            }
            return(_manager);
        }
Exemple #20
0
        public void CreateMarketingFirmWithManager()
        {
            int choice = Int32.Parse(Userinterface.GetUserInputFor("Enter 1 for stack manager, enter 2 for queue manager."));
            ISweepstakesManager manager;

            if (choice == 1)
            {
                manager = new SweepstakesStackManager();
            }
            else
            {
                manager = new SweepstakesQueueManager();
            }

            MarketingFirm marketingFirm = new MarketingFirm(manager);
        }
Exemple #21
0
        public ISweepstakesManager SelectASweepstakeManager(string input)
        {
            ISweepstakesManager manager;

            switch (input)
            {
            case "stack":
                return(manager = new SweepstakesStackManager());

            case "queue":
                return(manager = new SweepstakesQueueManager());

            default:
                Console.WriteLine("Invalid Entry");
                return(null);
            }
        }
Exemple #22
0
        static void Main(string[] args)
        {
            int choice = UserInterface.GetSweepstakesManager();

            switch (choice)
            {
            case 1:
                SweepstakesStackManager sweepstakesStackManager = new SweepstakesStackManager();
                MarketingFirm           marketingFirm           = new MarketingFirm(sweepstakesStackManager);
                break;

            case 2:
                SweepstakesQueueManager sweepstakesQueueManager = new SweepstakesQueueManager();
                MarketingFirm           marketingFirm2          = new MarketingFirm(sweepstakesQueueManager);
                break;
            }
        }
        //Member Variables (HAS A)

        //Constructor

        //Member Methods (CAN DO)
        public ISweepstakesManager CreatingmarketingFirmWithManager()
        {
            Console.WriteLine("What type of manager would you like to use to manage the sweepstake? Queue or Stack.");
            string input = Console.ReadLine();
            ISweepstakesManager manager = null;

            if (input == "Queue")
            {
                manager = new SweepstakesQueueManager();
            }
            else if (input == "Stack")
            {
                manager = new SweepstakesStackManager();
            }

            return(manager);
        }
        public static ISweepstakesManager GetSweepstakesManager(string managerChoice)
        {
            ISweepstakesManager sweepstakesManager;

            switch (managerChoice)
            {
            case "q":
                return(sweepstakesManager = new SweepstakesQueueManager());

            case "s":
                return(sweepstakesManager = new SweepstakesStackManager());

            default:
                Exception exception = new ArgumentException();
                throw exception;
            }
        }
        public ISweepstakesManager UserChoice(string choice)
        {
            switch (choice)
            {
            case "stack":
                SweepstakesStackManager _StackManager = new SweepstakesStackManager();
                return(_StackManager);

            case "queue":
                SweepstakesQueueManager _QueueManager = new SweepstakesQueueManager();
                return(_QueueManager);

            default:
                SweepstakesQueueManager _DefaultQueueManager = new SweepstakesQueueManager();
                return(_DefaultQueueManager);
            }
        }
Exemple #26
0
        public static Manager ChooseManager(string input)
        {
            Manager manager;

            switch (input)
            {
            case "q":
                manager = new SweepstakesQueueManager();
                return(manager);

            case "s":
                manager = new SweepstakesStackManager();
                return(manager);

            default:
                return(null);
            }
        }
        //public void CreateMarketingFirmWithManager()
        //{
        //    ISweepstakesManager manager;
        //    string input = UserInterface.EnterManagerChoice();
        //    if (input == "1")
        //    {
        //        manager = new SweepstakesStackManager();
        //        MarketingFirm firm = new MarketingFirm(manager);
        //    }
        //    else if (input == "2")
        //    {
        //        manager = new SweepstakesQueueManager();
        //        MarketingFirm firm = new MarketingFirm(manager);
        //    }
        //}

        public void CreateMarketingFirmWithManager()
        {
            ISweepstakesManager manager = null;
            string input = UserInterface.EnterManagerChoice();

            switch (input)
            {
            case "1":
                manager = new SweepstakesStackManager();
                //MarketingFirm stackFirm = new MarketingFirm(manager);
                break;

            case "2":
                manager = new SweepstakesQueueManager();
                //MarketingFirm queueFirm = new MarketingFirm(manager);
                break;
            }
            MarketingFirm firm = new MarketingFirm(manager);
        }
Exemple #28
0
        public void CreateMarketingFirmWithManager()
        {
            string userSelectedManager = UserInterface.GetUserInput("Press 0 for stack manager or 1 for queue manager");

            if (userSelectedManager == "0")
            {
                SweepstakesStackManager stackManager  = new SweepstakesStackManager();
                MarketingFirm           marketingFirm = new MarketingFirm(stackManager);
            }
            else if (userSelectedManager == "1")
            {
                SweepstakesQueueManager queueManager  = new SweepstakesQueueManager();
                MarketingFirm           marketingFirm = new MarketingFirm(queueManager);
            }
            else
            {
                Console.WriteLine("Please make a valid selection");
                CreateMarketingFirmWithManager();
            }
        }
Exemple #29
0
        public static ISweepstakesManager ChooseManager()
        {
            ISweepstakesManager manager;
            string choice = UserInterface.ChooseStackOrQueue();

            if (choice == "queue")
            {
                manager = new SweepstakesQueueManager();
                return(manager);
            }
            else if (choice == "stack")
            {
                manager = new SweepstakesStackManager();
                return(manager);
            }
            else
            {
                return(ChooseManager());
            }
        }
        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);
        }