Exemple #1
0
        /// <summary>
        /// Creates coffee with additives.
        /// </summary>
        /// <param name="cookMethod">Method of cooking particular coffee.</param>
        /// <param name="additives">All additives in particular coffee.</param>
        /// <param name="sugar">Amount of sugar in particular coffee.</param>
        /// <returns></returns>
        public Coffee GetCoffee(string cookMethod, Dictionary <string, double> additives, int sugar)
        {
            Coffee coffee = new Coffee(cookMethod, additives, sugar);

            return(coffee);
        }
Exemple #2
0
        /// <summary>
        /// Creates coffee without additives.
        /// </summary>
        /// <param name="cookMethod">Method of cooking particular coffee.</param>
        /// <param name="sugar">Amount of sugar in particular coffee.</param>
        /// <returns></returns>
        public Coffee GetCoffee(string cookMethod, int sugar)
        {
            Coffee coffee = new Coffee(cookMethod, sugar);

            return(coffee);
        }
        private void buttonTotal_Click(object sender, EventArgs e)
        {
            double tax;

            tax = 0.45;
            double latte, cappu, espr, mochac, filterCoff, irishCoff, flatCoff, affogato;
            double bbqBurg, delightBurg, crispyBurg, clubSan, cheeseSan, chiFry, nachos, freFries;

            //coffee
            latte = 60; cappu = 70; espr = 90; mochac = 120; filterCoff = 80; irishCoff = 70; flatCoff = 70; affogato = 90;

            double latte_c      = Convert.ToDouble(textLatte.Text);
            double cappu_c      = Convert.ToDouble(textCappuchino.Text);
            double espr_c       = Convert.ToDouble(textEspresso.Text);
            double mochac_c     = Convert.ToDouble(textMochaccino.Text);
            double filterCoff_c = Convert.ToDouble(textFilter.Text);
            double irishCoff_c  = Convert.ToDouble(textIrish.Text);
            double flatCoff_c   = Convert.ToDouble(textFlat.Text);
            double affogato_c   = Convert.ToDouble(textAffogato.Text);

            //others
            bbqBurg = 80; delightBurg = 70; crispyBurg = 70; clubSan = 60; cheeseSan = 70; chiFry = 65; nachos = 80; freFries = 40;

            double bbqBurg_o     = Convert.ToDouble(textBoxBbqBurger.Text);
            double delightBurg_o = Convert.ToDouble(textDelightBurger.Text);
            double crispyBurg_o  = Convert.ToDouble(textCrispyBurger.Text);
            double clubSan_o     = Convert.ToDouble(textClubSandwich.Text);
            double cheeseSan_o   = Convert.ToDouble(textCheeseSandwich.Text);
            double chiFry_o      = Convert.ToDouble(textChickenFry.Text);
            double nachos_o      = Convert.ToDouble(textNachos.Text);
            double freFries_o    = Convert.ToDouble(textFrenchFries.Text);

            Coffee eat_in_cafe = new Coffee(latte_c, cappu_c, espr_c, mochac_c, filterCoff_c,
                                            irishCoff_c, flatCoff_c, affogato_c, bbqBurg_o, delightBurg_o, crispyBurg_o, clubSan_o,
                                            cheeseSan_o, chiFry_o, nachos_o, freFries_o);

            double cost_of_drinks = (latte_c * latte) + (cappu_c * cappu) + (espr_c * espr) + (mochac_c * mochac)
                                    + (filterCoff_c * filterCoff) + (irishCoff_c * irishCoff) + (flatCoff_c * flatCoff) + (affogato_c * affogato);

            labelCostDrinks.Text = Convert.ToString(cost_of_drinks);

            double cost_of_others = (bbqBurg_o * bbqBurg) + (delightBurg_o * delightBurg) + (crispyBurg_o * crispyBurg)
                                    + (clubSan_o * clubSan) + (cheeseSan_o * cheeseSan) + (chiFry_o * chiFry) + (nachos_o * nachos)
                                    + (freFries_o * freFries);

            labelCostOthers.Text = Convert.ToString(cost_of_others);


            labelService.Text = Convert.ToString(((cost_of_drinks + cost_of_others) * 3) / 100);
            double Service_charge = Convert.ToDouble(labelService.Text);

            labelSubTotal.Text = Convert.ToString(cost_of_drinks + cost_of_others + Service_charge);
            labelTax.Text      = Convert.ToString(((cost_of_drinks + cost_of_others + Service_charge) * tax) / 100);
            double iTax = Convert.ToDouble(labelTax.Text);

            labelTotal.Text = Convert.ToString(cost_of_drinks + cost_of_others + iTax + Service_charge);


            labelCostDrinks.Text = String.Format("{0:C}", cost_of_drinks);
            labelCostOthers.Text = String.Format("{0:C}", cost_of_others);
            labelService.Text    = String.Format("{0:C}", Service_charge);
            labelSubTotal.Text   = String.Format("{0:C}", (cost_of_drinks + cost_of_others + Service_charge));
            labelTax.Text        = String.Format("{0:C}", iTax);
            labelTotal.Text      = String.Format("{0:C}", (cost_of_drinks + cost_of_others + Service_charge + iTax));
        }