// member methods (CAN DO)
        public CoffeeCup SellCoffeeCup()
        {
            GreetCustomer();

            if (coffeeCups.Count > 0)
            {
                string customerResponseToBuyingCoffee = AskCustomerToBuyCoffee();

                if (customerResponseToBuyingCoffee == "yes")
                {
                    CoffeeCup coffeeToSell = coffeeCups[0];
                    coffeeCups.RemoveAt(0);

                    return(coffeeToSell);
                }
                else
                {
                    Console.WriteLine("Ok! Thanks for visiting! Hope to see you soon!");
                }
            }
            else
            {
                Console.WriteLine("Unfortunately, we are out of coffee...");
            }

            return(null);
        }
        private List <CoffeeCup> coffeeCups; // the shop has 5 cups of coffee to sell

        // constructor (SPAWNER)
        public CoffeeShop()
        {
            coffeeCups = new List <CoffeeCup>();

            for (int i = 0; i < 5; i++)
            {
                CoffeeCup cupOfCoffee = new CoffeeCup();
                coffeeCups.Add(cupOfCoffee);
            }
        }
Пример #3
0
        // member methods (CAN DO)
        public void DrinkFromCupOfCoffee()
        {
            if (cupOfCoffee != null)
            {
                cupOfCoffee.percentageFull -= 10;
                caffineLevel++;

                if (cupOfCoffee.percentageFull <= 0)
                {
                    cupOfCoffee = null;
                }
            }
        }
Пример #4
0
        public int caffineLevel; // scale of 1 - 10

        // constructor (SPAWNER)
        public Customer()
        {
            cupOfCoffee  = null;
            caffineLevel = 1;
        }