public void DisplayCalories()
 {
     Console.WriteLine(GetType().Name + ": " + Calories.ToString() + " calories.");
     foreach (SoftDrink drink in Flavors)
     {
         drink.DisplayCalories();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Преобразовать данные в строку
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string text = ProductName + " " + Quantity.ToString("f2") + "шт " + Calories.ToString("f2") + "Дж " + Price.ToString("f2") + "р,\r\n";

            text += "Состав: ";
            foreach (var item in CompositionList)
            {
                text += item.Name + " " + item.Value.ToString("f2") + "кг " + item.Calorie.ToString("f2") + "Дж " + item.Price.ToString("f2") + "р,\r\n";
            }
            return(text);
        }
Exemplo n.º 3
0
 public override string ToString()
 {
     return($"{Name} made by {Manufacturer} has a serving size of {Cups.ToString("N1")} cups and has {Calories.ToString("N2")} calories.");
 }
Exemplo n.º 4
0
        public override string ToString()
        {
            string str = "";

            str += "&idserver=\"" + IDServer.ToString() + "\"";
            if (IDUnit != -1)
            {
                str += "&idunit=\"" + IDUnit.ToString() + "\"";
            }
            if (IDServerMeal != -1)
            {
                str += "&idmeal=\"" + IDServerMeal.ToString() + "\"";
            }
            if (IDUser != 0)
            {
                str += "&iduser=\"" + IDUser.ToString() + "\"";
            }
            if (Calories != -1)
            {
                str += "&calories=\"" + Calories.ToString() + "\"";
            }
            if (Protein != -1)
            {
                str += "&protein=\"" + Protein.ToString() + "\"";
            }
            if (Carb != -1)
            {
                str += "&carb=\"" + Carb.ToString() + "\"";
            }
            if (Fat != -1)
            {
                str += "&fat=\"" + Fat.ToString() + "\"";
            }
            if (SatFat != -1)
            {
                str += "&satfat=\"" + SatFat.ToString() + "\"";
            }
            if (UnSatFat != -1)
            {
                str += "&unsatfat=\"" + UnSatFat.ToString() + "\"";
            }
            if (Cholesterol != -1)
            {
                str += "&cholesterol=\"" + Cholesterol.ToString() + "\"";
            }
            if (Sugar != -1)
            {
                str += "&sugar=\"" + Sugar.ToString() + "\"";
            }
            if (Natrium != -1)
            {
                str += "&natrium=\"" + Natrium.ToString() + "\"";
            }
            if (Potassium != -1)
            {
                str += "&potassium=\"" + Potassium.ToString() + "\"";
            }
            if (Fiber != -1)
            {
                str += "&fiber=\"" + Fiber.ToString() + "\"";
            }
            if (Deleted != -1)
            {
                str += "&deleted=\"" + Deleted.ToString() + "\"";
            }
            if (InsertDate != null)
            {
                str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }
            if (UpdateDate != null)
            {
                str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }

            return(str.Substring(1));
        }
 public string ToString()
 {
     return(Weight.ToString() + "kg , " + Calories.ToString() + "cal");
 }
Exemplo n.º 6
0
        private void printbutton_Click(object sender, EventArgs e)
        {
            var l = new Calories(Convert.ToChar(SexText.Text), Convert.ToDouble(HeightText.Text), Convert.ToDouble(WeightText.Text), Convert.ToDouble(YearsText.Text), Convert.ToDouble(RateText.Text));

            MessageBox.Show(l.ToString());
        }
Exemplo n.º 7
0
 public override string ToString()
 {
     return($"{Name} made by {Manufacturer} contains {Calories.ToString("N1")} calories per serving and {Cups.ToString("N1")} cups per serving.");
 }