Задача - Магазин за плодове, По - сложни проверки C# PB
Някой може ли да ми покаже за дати задача ? Направил съм я със switch. Дава ми 76/100 в judge.
https://pastebin.com/Tf2TtWDK
Някой може ли да ми покаже за дати задача ? Направил съм я със switch. Дава ми 76/100 в judge.
https://pastebin.com/Tf2TtWDK
For Monday-Friday include the default 'error' message as you have done for Saturday/Sunday. Otherwise your code gives not the correct result for 'tomato monday 0.5'. Also when there is a wrong input, you shouldn't print the final result (quantity * price);
Code:
using System;
namespace ConsoleApp7
{
class Program
{
static void Main(string[] args)
{
// Задача - Магазин за плодове
string fruit = Console.ReadLine();
string day = Console.ReadLine();
bool wrongInput = false;
double quantity = double.Parse(Console.ReadLine());
double price = 0;
switch (day)
{
case "Monday":
case "Tuesday":
case "Wednesday":
case "Thursday":
case "Friday":
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:
wrongInput = true;
Console.WriteLine("error");
break;
}
break;
case "Saturday":
case "Sunday":
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:
wrongInput = true;
Console.WriteLine("error");
break;
}
break;
default:
break;
}
if (wrongInput == false)
{
Console.WriteLine($"{quantity * price:f2}");
}
}
}
}
thank you for sharing great information.
There are many ways to download videos from Facebook. Here is online Facebook downloader that allow you to save Facebook video in high-quality or low-quality MP4 file format. download from facebook.