private void SetDefaultValues()
 {
     _type      = CoffeeType.Espresso;
     _size      = CoffeeSize.Small;
     _sweetness = CoffeeSweetness.OneSpoon;
     _addons.Clear();
 }
Example #2
0
 public CoffeeSettings(string coffeeName, float waterUsed, float coffeeSeedsUsed, CoffeeStrength coffeeStrength, CoffeeSize coffeeSize)
 {
     this.coffeeName      = coffeeName;
     this.waterUsed       = waterUsed;
     this.coffeeSeedsUsed = coffeeSeedsUsed;
     this.coffeeSize      = coffeeSize;
     this.coffeeStrength  = coffeeStrength;
 }
Example #3
0
    public void ChangeCoffeeSize(CoffeeSize coffeeSize)
    {
        if (!machineEnabled)
        {
            return;
        }

        selectedCoffeeSize = coffeeSize;
    }
 public Coffee(
     CoffeeKind kind,
     int strength,
     CoffeeSize size)
 {
     Kind     = kind;
     Strength = strength;
     Size     = size;
 }
        public decimal GetPrice(CoffeeSize size, Cream cream, Sugar sugar)
        {
            // Arrange

            // Act
            var result = _coffee.GetPrice(size, cream, sugar);

            // Assert
            return(result);
        }
        public decimal GetBasePrice(CoffeeSize size)
        {
            // Arrange

            // Act
            var result = _coffee.GetBasePrice(size);

            // Assert
            return(result);
        }
        private void Reset()
        {
            Size = CoffeeSize.Small;

            _extraQtyByExtra = new Dictionary <Extra, int>();

            foreach (Extra extra in Enum.GetValues(typeof(Extra)))
            {
                _extraQtyByExtra[extra] = 0;
            }
        }
Example #8
0
        public void ChangeCoffeeSize()
        {
            if (!Operational)
            {
                return;
            }

            coffeeSize         = NextSetting <CoffeeSize>(coffeeSize, sizeToWaterAmount.Count - 1);
            currentCoffee.size = coffeeSize;

            display.DisplayTimedMsg(DisplayMessage.SetCoffeeSize, coffeeSize.ToString());
        }
        public Coffee(
            CoffeeKind kind,
            int strength,
            CoffeeSize size,
            string customerName)
        {
            Kind         = kind;
            Strength     = strength;
            Size         = size;
            CustomerName = customerName;

            CoffeesCreated++;
        }
Example #10
0
        public void PlaceOrder_ReturnsCoffeeOrder(CoffeeSize size, int creamQty, int sugarQty)
        {
            _coffeeOrderHandler.Size = size;

            AddExtra(Extra.Cream, creamQty);
            AddExtra(Extra.Sugar, sugarQty);

            var coffeeOrder = _coffeeOrderHandler.PlaceOrder();

            Assert.AreEqual(size.ToString(), coffeeOrder.Size);
            Assert.AreEqual(creamQty, coffeeOrder.CreamQty);
            Assert.AreEqual(sugarQty, coffeeOrder.SugarQty);
        }
Example #11
0
    public Coffee GetSpecificCoffee(CoffeeStrength coffeeStrength, CoffeeSize coffeeSize)
    {
        foreach (var coffeeSettings in possibleCoffees)
        {
            if (coffeeSettings.CoffeeSize == coffeeSize && coffeeSettings.CoffeeStrength == coffeeStrength)
            {
                return(coffeeSettings.GetCoffeeFromThisSettings());
            }
        }

        Debug.LogError($"[{this}] Couldn't find settings for that type of coffee: {coffeeSize}, {coffeeStrength}");
        return(null);
    }
Example #12
0
        /// <summary>

        /// Entry point into console application.

        /// </summary>

        static void Main()
        {
            ICoffee orderedCoffee = new CoffeeSize(new CoffeeSize(new Coffee()));

            ((CoffeeSize)orderedCoffee).SetSize("medium");

            orderedCoffee = new CoffeeSugar(orderedCoffee);
            orderedCoffee = new CoffeeSugar(orderedCoffee);
            orderedCoffee = new CoffeeSugar(orderedCoffee);

            orderedCoffee = new CoffeeCreamer(orderedCoffee);
            orderedCoffee = new CoffeeCreamer(orderedCoffee);
            orderedCoffee = new CoffeeCreamer(orderedCoffee);
            orderedCoffee = new CoffeeCreamer(orderedCoffee);

            Console.WriteLine(orderedCoffee.Price);
        }
Example #13
0
        public decimal CalculateTotal_SingleCoffee(CoffeeSize size)
        {
            // Arrange
            Coffee coffee = new Coffee()
            {
                Size = size
            };
            List <Coffee> list = new List <Coffee>();

            list.Add(coffee);

            // Act
            var result = _order.CalculateTotal(list);

            // Assert
            return(result);
        }
        public decimal GetBasePrice(CoffeeSize size)
        {
            switch (size)
            {
            case CoffeeSize.Small:
                return(1.75m);

            case CoffeeSize.Medium:
                return(2.00m);

            case CoffeeSize.Large:
                return(2.25m);

            default:
                throw new Exception("New size has been added to system without a price in mind.");
            }
        }
Example #15
0
            public double CalcPrice(CoffeeSize coffeeSize)
            {
                switch (coffeeSize)
                {
                case CoffeeSize.Small:
                    return(0.20);

                case CoffeeSize.Normal:
                    return(0.40);

                case CoffeeSize.Double:
                    return(0.60);

                default:
                    throw new InvalidOperationException(
                              "Unsupported coffee quantity: " + (int)coffeeSize);
                }
            }
        public decimal GetPrice(CoffeeSize size, Cream cream, Sugar sugar)
        {
            decimal price = 0m;

            price += GetBasePrice(size);

            if (cream != null)
            {
                price += cream.Price * cream.Quantity;
            }

            if (sugar != null)
            {
                price += sugar.Price * sugar.Quantity;
            }

            return(price);
        }
        public static void Main(string[] args)
        {
            var        coffee         = new Coffee();
            int        size           = (int)CoffeeSize.Small;
            int        coffeSize      = (int)coffee.Size;
            CoffeeSize largeCoffeSize = (CoffeeSize)200;

            Console.WriteLine(coffee.Size);
            Console.WriteLine(size);
            Console.WriteLine(coffeSize);
            coffee.Size = CoffeeSize.Medium;
            Console.WriteLine(coffee.Size);
            Console.WriteLine(largeCoffeSize + "\n");

            var color = Color.Green;


            if (color == Color.Green)
            {
                Console.WriteLine("Aleluq");
            }

            switch (color)
            {
            case Color.White:
                break;

            case Color.Blacl:
                break;

            case Color.Red:
                break;

            case Color.Blue:
                break;

            case Color.Green:
                Console.WriteLine("Green");
                break;

            default:
                break;
            }
        }
Example #18
0
        static void Main(string[] args)
        {
            var served = new Dictionary <(CoffeeKind kind, CoffeeSize size, int strength), int>();

            void Serve(string customerName, CoffeeKind kind, CoffeeSize size, int strength)
            {
                Console.WriteLine($"Serving a {size} {kind} of strength {strength} to {customerName}");

                var key = (kind, size, strength);

                if (served.ContainsKey(key) == false)
                {
                    served[key] = 1;
                }
                else
                {
                    served[key]++;
                }
            }

            void PrintSummary() => served
            .OrderByDescending(kv => kv.Value)
            .ThenBy(kv => kv.Key.kind)
            .ThenByDescending(kv => kv.Key.size)
            .ThenByDescending(kv => kv.Key.strength)
            .Select(kv => $"Served {kv.Value} {kv.Key.size} {kv.Key.kind} of strength {kv.Key.strength}")
            .ToList()
            .ForEach(Console.WriteLine)
            ;

            RandomHelper helper = new RandomHelper();

            for (int i = 0; i < 100; i++)
            {
                CoffeeKind kind     = helper.GetRandomCoffeeKind();
                CoffeeSize size     = helper.GetRandomCoffeeSize();
                int        strength = helper.GetRandomCoffeeStrength();

                Serve(helper.GetRandomName(), kind, size, strength);
            }

            Console.WriteLine();
            PrintSummary();
        }
Example #19
0
        static void Main(string[] args)
        {
            void Serve(string customerName, CoffeeKind kind, CoffeeSize size, int strength)
            {
                Console.WriteLine($"Serving a {size} {kind} of strength {strength} to {customerName}");
            }

            RandomHelper helper = new RandomHelper();

            for (int i = 0; i < 100; i++)
            {
                CoffeeKind kind     = helper.GetRandomCoffeeKind();
                CoffeeSize size     = helper.GetRandomCoffeeSize();
                int        strength = helper.GetRandomCoffeeStrength();

                Serve(helper.GetRandomName(), kind, size, strength);
            }

            Console.WriteLine();
        }
Example #20
0
        public void Load(string baseId)
        {
            CoffeeMachineState state = SaveLoadSystem.Load <CoffeeMachineState>(baseId, "CoffeeMachine");

            if (state == null)
            {
                state = new CoffeeMachineState();
            }

            currentCoffee        = state.currentCoffee;
            coffeeSetFromOutside = state.coffeeSetFromOutside;
            coffeeStrength       = state.coffeeStrength;
            coffeeSize           = state.coffeeSize;

            if (state.status == Status.Idle || state.status == Status.Busy)
            {
                TurnOn();
            }

            MyLog.TryLog(this, $"Loaded", debug);
            MyLog.TryLog(this, JsonConvert.SerializeObject(state), debug);
        }
Example #21
0
 private Coffee(CoffeeSize size)
 {
     this.size = size;
 }
Example #22
0
 public Espresso(CoffeeSize size)
 {
     Size = size;
 }
Example #23
0
 public Coffee(CoffeeSize size)
 {
     this.size = size;
 }
Example #24
0
 public Whip(IBeverage beverage)
 {
     Beverage = beverage;
     Size     = beverage.Size;
 }
Example #25
0
 public void ChooseSmall()
 {
     _size = CoffeeSize.Small;
 }
Example #26
0
 public Mocha(IBeverage beverage)
 {
     Beverage = beverage;
     Size     = beverage.Size;
 }
Example #27
0
 public Soy(IBeverage beverage)
 {
     Beverage = beverage;
     Size     = beverage.Size;
 }
Example #28
0
 public Milk(IBeverage beverage)
 {
     Beverage = beverage;
     Size     = beverage.Size;
 }
Example #29
0
 public Coffee(CoffeeSize size)
 {
     this.size = size;
 }
Example #30
0
 public DarkRoast(CoffeeSize size)
 {
     Size = size;
 }
        public static void Start()
        {
            try
            {
                CoffeeSize small  = CoffeeSize.small;
                CoffeeSize medium = CoffeeSize.medium;
                CoffeeSize large  = CoffeeSize.large;


                //Declaring all of my variables
                double emp1total; double emp2total; double emp3total; double emp4total; double emp5total;

                double emp1ot = 0; double emp2ot = 0; double emp3ot = 0; double emp4ot = 0; double emp5ot = 0;

                double emp1totalbeforeot = 0; double emp2totalbeforeot = 0; double emp3totalbeforeot = 0; double emp4totalbeforeot = 0; double emp5totalbeforeot = 0;

                //Ask for input
                Console.WriteLine("1. Press 1 to calculate sales");
                Console.WriteLine();
                Console.WriteLine("2. Press 2 to calculate payroll");
                Console.WriteLine();
                Console.WriteLine("3. Press 3 to close application");

                //Convert Input to int Answer
                int answer = Convert.ToInt32(Console.ReadLine());

                //If answer = 1 then ask for Coffee/Sandwiches
                if (answer == 1)
                {
                    Console.WriteLine("Enter the number of small coffes sold");
                    Int64 Small = Convert.ToInt64(Console.ReadLine());
                    Console.WriteLine("Enter the number of medium coffes sold");
                    Int64 Medium = Convert.ToInt64(Console.ReadLine());
                    Console.WriteLine("Enter the number of large coffes sold");
                    Int64 Large = Convert.ToInt64(Console.ReadLine());
                    Console.WriteLine("Enter the number of Egg sandwiches sold");
                    Int64 Egg = Convert.ToInt64(Console.ReadLine());
                    Console.WriteLine("Enter the number of Chicken sandwiches sold");
                    Int64 Chicken = Convert.ToInt64(Console.ReadLine());

                    //Declare Totals
                    double smalltotal   = Small * (int)small;
                    double mediumtotal  = Medium * (int)medium;
                    double largetotal   = Large * (int)large;
                    double chickentotal = Chicken * 7.50;
                    double eggtotal     = Egg * 5.50;

                    double smallcost   = Small * .10;
                    double mediumcost  = Medium * .15;
                    double largecost   = Large * .20;
                    double chickencost = Chicken * 1.20;
                    double eggcost     = Egg * .95;

                    //declare profit / costs / and sales
                    double totalsales = Add(smalltotal, mediumtotal, largetotal, eggtotal, chickentotal);
                    double totalcost  = Add(smallcost, mediumcost, largecost, eggcost, chickencost);
                    double profit     = totalsales - totalcost;
                    Console.WriteLine("The total Sales amount is $" + totalsales);
                    Console.WriteLine("The total costs is $" + totalcost);
                    Console.WriteLine("The total profit is $" + profit);

                    Console.ReadLine();
                    //return to start
                    Console.Clear();
                    Start();
                }

                // If answer is 2 then ask for every employees hours
                if (answer == 2)
                {
                    Console.WriteLine("Enter Employee 1 total hours");
                    double emp1hrs = Convert.ToDouble(Console.ReadLine());

                    //if less than 40 hrs
                    if (emp1hrs <= 40)
                    {
                        emp1totalbeforeot = emp1hrs * 12.50;
                    }
                    //if over 40 hrs / calulate OT
                    else if (emp1hrs > 40)
                    {
                        emp1ot            = (emp1hrs - 40) * 18.75;
                        emp1totalbeforeot = 40 * 12.50;
                        emp1total         = 40 * 12.50 + emp1ot;
                    }


                    Console.WriteLine("Enter Employee 2 total hours");
                    double emp2hrs = Convert.ToDouble(Console.ReadLine());

                    if (emp2hrs <= 40)
                    {
                        emp2totalbeforeot = emp2hrs * 12.50;
                    }

                    else if (emp2hrs > 40)
                    {
                        emp2ot            = (emp2hrs - 40) * 18.75;
                        emp2totalbeforeot = 40 * 12.50;
                        emp2total         = 40 * 12.50 + emp2ot;
                    }

                    Console.WriteLine("Enter Employee 3 total hours");
                    double emp3hrs = Convert.ToDouble(Console.ReadLine());

                    if (emp3hrs <= 40)
                    {
                        emp3totalbeforeot = emp3hrs * 12.50;
                    }

                    else if (emp3hrs > 40)
                    {
                        emp3ot            = (emp3hrs - 40) * 18.75;
                        emp3totalbeforeot = 40 * 12.50;
                        emp3total         = 40 * 12.50 + emp3ot;
                    }

                    Console.WriteLine("Enter Employee 4 total hours");
                    double emp4hrs = Convert.ToDouble(Console.ReadLine());

                    if (emp4hrs <= 40)
                    {
                        emp4totalbeforeot = emp4hrs * 12.50;
                    }

                    else if (emp4hrs > 40)
                    {
                        emp4ot            = (emp4hrs - 40) * 18.75;
                        emp4totalbeforeot = 40 * 12.50;
                        emp4total         = 40 * 12.50 + emp4ot;
                    }
                    Console.WriteLine("Enter Employee 5 total hours");
                    double emp5hrs = Convert.ToDouble(Console.ReadLine());

                    if (emp5hrs <= 40)
                    {
                        emp5totalbeforeot = emp5hrs * 12.50;
                    }

                    else if (emp5hrs > 40)
                    {
                        emp5ot            = (emp5hrs - 40) * 18.75;
                        emp5totalbeforeot = 40 * 12.50;
                        emp5total         = 40 * 12.50 + emp5ot;
                    }
                    // Calculate total OT / Standard pay / Total pay
                    double overtime = Add(emp1ot, emp2ot, emp3ot, emp4ot, emp5ot);
                    double basepay  = Add(emp1totalbeforeot, emp2totalbeforeot, emp3totalbeforeot, emp4totalbeforeot, emp5totalbeforeot);
                    double total    = overtime + basepay;
                    Console.WriteLine("Your standard pay roll is $" + basepay);
                    Console.WriteLine("Your overtime payroll is $" + overtime);
                    Console.WriteLine("Your total payroll is $" + total);
                    Console.ReadLine();
                    Console.Clear();
                    Start();
                }

                //if input is 3 then exit app
                if (answer == 3)
                {
                    Console.WriteLine("Thanks for stopping by!!!");
                    Console.ReadLine();
                }

                if (answer > 3)
                {
                    Console.WriteLine("Enter 1, 2, or 3!");
                    Console.WriteLine();
                    Start();
                }
            }

            //Exception handling
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
                Console.Clear();
                Start();
            }
        }
Example #32
0
 public void ChooseBig()
 {
     _size = CoffeeSize.Big;
 }