Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FruitShop
- {
- 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")
- {
- if (fruit == "banana")
- {
- price = 2.50 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "apple")
- {
- price = 1.20 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "orange")
- {
- price = 0.85 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "grapefruit")
- {
- price = 1.45 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "kiwi")
- {
- price = 2.70 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "pineapple")
- {
- price = 5.5 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "grapes")
- {
- price = 3.85 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- // week days:
- //плод banana apple orange grapefruit kiwi pineapple grapes
- // цена 2.50 1.20 0.85 1.45 2.70 5.50 3.85
- else if (day == "Saturday" || day == "Sunday")
- {
- if (fruit == "banana")
- {
- price = 2.70 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "apple")
- {
- price = 1.25 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "orange")
- {
- price = 0.90 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "grapefruit")
- {
- price = 1.60 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "kiwi")
- {
- price = 3.00 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "pineapple")
- {
- price = 5.6 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else if (fruit == "grapes")
- {
- price = 4.2 * quantity;
- Console.WriteLine($"{price:F2}");
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- //weekend days:
- //плод banana apple orange grapefruit kiwi pineapple grapes
- // цена 2.70 1.25 0.90 1.60 3.00 5.60 4.20
- //Print: Резултатът да се отпечата закръглен с 2 цифри след десетичната точка.
- //При невалиден ден от седмицата или невалидно име на плод да се отпечата "error".
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement