Магазин за плодове
Здравейте, не мога да стигна до дебъг на програмата понеже ми дава някаква грешка :(. Не знам дали въобще работи кода.Може ли някой да помогне с тази грешка за да си проверя кода,че ме измъчи 2 дена :D
using System;
namespace FruitShop
{
class Program
{
static int Main(string[] args)
{
string fruit = Console.ReadLine();
string dayOfWeek = Console.ReadLine();
double quantity = double.Parse(Console.ReadLine());
//orange grapefruit kiwi pineapple grapes
double price = 0;
switch (dayOfWeek)
{
case ("Monday"):
case ("Tuesday"):
case ("Wdnsday"):
case ("Thursday"):
case ("Friday"):
case ("Saturday"):
case ("Sunday"):
break;
default:
Console.WriteLine("error");
break;
}
switch (fruit)
{
case ("banana"):
case ("orange"):
case ("grapefruit"):
case ("kiwi"):
case ("pineapple"):
case ("grapes"):
break;
default:
{
Console.WriteLine("error");
break;
}
}
if ((dayOfWeek == "Monday") || (dayOfWeek == "Tuesday") && (dayOfWeek == "Thursday") &&
(dayOfWeek == "Friday"))
{
if (fruit == "banana")
{
price = quantity * 2.5;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "orange")
{
price = quantity * 0.85;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "grapefruit")
{
price = quantity * 1.45;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "kiwi")
{
price = quantity * 2.70;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "pineapple")
{
price = quantity * 5.50;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "grapes")
{
price = quantity * 3.85;
Console.WriteLine($"{price:F2}");
}
}
else if ((dayOfWeek == "Saturday") || (dayOfWeek == "Sunday"))
{
if (fruit == "banana")
{
price = quantity * 2.70;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "apple")
{
price = quantity * 1.25;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "orange")
{
price = quantity * 0.90;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "grapefruit")
{
price = quantity * 1.60;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "kiwi")
{
price = quantity * 3.00;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "pineapple")
{
price = quantity * 5.60;
Console.WriteLine($"{price:F2}");
}
else if (fruit == "grapes")
{
price = quantity * 3.85;
Console.WriteLine($"{price:F2}");
}
}
//else
//{
// Console.WriteLine("error");
//}
//else if ((dayOfWeek != "Monday")||(dayOfWeek!="Tuesday")||(dayOfWeek!="Wdnsday")||(dayOfWeek!="Thursday")||
// (dayOfWeek != "Friday") || (dayOfWeek != "Saturday") || (dayOfWeek != "Sunday"))
// {
// Console.WriteLine("error");
// }
}
}
}
Не съм бутал нищо там, не знам защо така стана. Благодаря🙂