Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Ervin05 avatar Ervin05 0 Точки

не знам как да довърша и реша задачата

using System;

namespace Fruit_Shop
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string fruit = Console .ReadLine ();
            string day = Console .ReadLine ();
            double quantuty = double.Parse (Console .ReadLine ());
            double priceBanana = 0;
            double priceApple = 0;
            double priceOrange= 0;
            double priceGrapefruit = 0;
            double priceKiwi = 0;
            double pricePineapple = 0;
            double priceGrapes = 0;


            if (fruit == "banana" || fruit == "apple" || fruit == "orange" || fruit == "grapefruit"|| 
                fruit == "kiwi"|| fruit == "pineapple"|| fruit == "grapes")
            {
                if (day== "Monday" || day == "Tuesday"|| day == "Wednesday"|| day == "Thursday"|| day == "Friday")
                {
                     priceBanana = 2.50;
                     priceApple =1.20;
                     priceOrange = 0.85;
                     priceGrapefruit = 1.45;
                     priceKiwi =2.70 ;
                     pricePineapple = 5.50;
                    priceGrapes =3.85 ;

 

 

                }
                else if (day=="Saturday" || day=="Sunday")
                {
                    priceBanana = 2.70;
                    priceApple = 1.25;
                    priceOrange = 0.90;
                    priceGrapefruit =1.60 ;
                    priceKiwi =3.00;
                    pricePineapple = 5.60;
                    priceGrapes = 4.20;

                }
                else
                {
                    Console.WriteLine("error");
                }
            }
            else
            {
                Console.WriteLine("error");
            }

           
        }
    }
}

Тагове:
0
Programming Basics with C#
dimitarglavianov avatar dimitarglavianov 110 Точки
 
using System;

namespace _11FruitShop
{
    class Program
    {
        static void Main(string[] args)
        {
            string fruit = Console.ReadLine();
            string day = Console.ReadLine();
            double quantity = double.Parse(Console.ReadLine());
            double price = 0;
            if ((day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday") && (fruit == "banana" || fruit == "apple"
                        || fruit == "orange" || fruit == "grapefruit" || fruit == "kiwi" || fruit == "pineapple" || fruit == "grapes"))
            {
                switch (fruit)
                {
                    case "banana":
                        price = 2.50;
                        break;
                    case "apple":
                        price = 1.20;
                        break;
                    case "orange":
                        price = 0.85;
                        break;
                    case "grapefruit":
                        price = 1.45;
                        break;
                    case "kiwi":
                        price = 2.70;
                        break;
                    case "pineapple":
                        price = 5.50;
                        break;
                    case "grapes":
                        price = 3.85;
                        break;

                    default:
                        Console.WriteLine("error");
                        break;


                }


                Console.WriteLine($"{(quantity * price):f2}");

            }
            else if ((day == "Saturday" || day == "Sunday") && (fruit == "banana" || fruit == "apple"
                        || fruit == "orange" || fruit == "grapefruit" || fruit == "kiwi" || fruit == "pineapple" || fruit == "grapes"))
            {
                switch (fruit)
                {
                    case "banana":
                        price = 2.70;
                        break;
                    case "apple":
                        price = 1.25;
                        break;
                    case "orange":
                        price = 0.90;
                        break;
                    case "grapefruit":
                        price = 1.60;
                        break;
                    case "kiwi":
                        price = 3.00;
                        break;
                    case "pineapple":
                        price = 5.60;
                        break;
                    case "grapes":
                        price = 4.20;
                        break;

                    default:
                        Console.WriteLine("error");
                        break;

                }

                Console.WriteLine($"{(quantity * price):f2}");
            }
            
            else
            {
                Console.WriteLine("error");
            }

        }
    }
}

 

2
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.