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 dayOfweek = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double priceForbanana = 2.50;
- double priceForapple = 1.20;
- double priceFororange = 0.85;
- double priceForgrapefruit = 1.45;
- double priceForkiwi = 2.70;
- double priceForpineapple = 5.50;
- double priceForgrapes = 3.85;
- double priceForbananaW = 2.70;
- double priceForappleW = 1.25;
- double priceFororangeW = 0.90;
- double priceForgrapefruitW = 1.60;
- double priceForkiwiW = 3.00;
- double priceForpineappleW = 5.60;
- double priceForgrapesW = 4.20;
- double totalPrice = 0;
- double totalPrice2 = 0;
- if (dayOfweek == "Monday" || dayOfweek == "Tuesday" || dayOfweek == "Wednesday" || dayOfweek == "Thursday" || dayOfweek == "Friday")
- {
- if (fruit == "banana")
- {
- totalPrice = quantity * priceForbanana;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "apple")
- {
- totalPrice = quantity * priceForapple;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "orange")
- {
- totalPrice = quantity * priceFororange;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "grapefruit")
- {
- totalPrice = quantity * priceForgrapefruit;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "kiwi")
- {
- totalPrice = quantity * priceForkiwi;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "pineapple")
- {
- totalPrice = quantity * priceForpineapple;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "grapes")
- {
- totalPrice = quantity * priceForgrapes;
- Console.WriteLine($"{totalPrice:F2}");
- }
- }
- else if (dayOfweek == "Saturday" || dayOfweek == "Sunday")
- {
- if (fruit == "banana")
- {
- totalPrice = quantity * priceForbananaW;
- Console.WriteLine($"{totalPrice:F2}");
- if (fruit == "apple")
- {
- totalPrice = quantity * priceForappleW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "orange")
- {
- totalPrice = quantity * priceFororangeW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "grapefruit")
- {
- totalPrice = quantity * priceForgrapefruitW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "kiwi")
- {
- totalPrice = quantity * priceForkiwiW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "pineapple")
- {
- totalPrice = quantity * priceForpineappleW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit == "grapes")
- {
- totalPrice = quantity * priceForgrapesW;
- Console.WriteLine($"{totalPrice:F2}");
- }
- if (fruit != "banana" || fruit != "apple" || fruit != "orange" || fruit != "grapefruit" || fruit != "kiwi" || fruit != "pineaple" || fruit != "grapes")
- {
- Console.WriteLine("error");
- }
- if (dayOfweek != "Monday" || dayOfweek != "Tuesday" || dayOfweek != "Wednesday" || dayOfweek != "Friday" || dayOfweek != "Saturday" || dayOfweek != "Sunday")
- {
- Console.WriteLine("error");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement