Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Threading;
- public class FruitMarket
- {
- public static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- checked
- {
- string dayOfWeek = Console.ReadLine();
- Dictionary<string, decimal> priceList = new Dictionary<string, decimal>();
- priceList["banana"] = 1.80m;
- priceList["cucumber"] = 2.75m;
- priceList["tomato"] = 3.20m;
- priceList["orange"] = 1.60m;
- priceList["apple"] = 0.86m;
- decimal totalPrice = 0;
- for (int i = 0; i < 3; i++)
- {
- decimal quantity = decimal.Parse(Console.ReadLine());
- string product = Console.ReadLine();
- decimal productPrice = priceList[product];
- switch (dayOfWeek)
- {
- case "Friday":
- productPrice *= 0.90m;
- break;
- case "Sunday":
- productPrice *= 0.95m;
- break;
- case "Tuesday":
- if (product == "banana" || product == "orange" || product == "apple")
- {
- productPrice *= 0.80m;
- }
- break;
- case "Wednesday":
- if (product == "cucumber" || product == "tomato")
- {
- productPrice *= 0.90m;
- }
- break;
- case "Thursday":
- if (product == "banana")
- {
- productPrice *= 0.70m;
- }
- break;
- }
- totalPrice += quantity * productPrice;
- }
- Console.WriteLine("{0:f2}", totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement