Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class FruitShop
- {
- static void Main()
- {
- var fruit = Console.ReadLine().ToLower();
- var day = Console.ReadLine().ToLower();
- var quantity = double.Parse(Console.ReadLine());
- var price = -1.0;
- Dictionary<string, double> pricesWeek = new Dictionary<string, double>
- { { "banana", 2.50 }, { "apple",1.20}, { "orange",0.85},
- {"grapefruit",1.45}, {"kiwi",2.70}, { "pineapple",5.50}, { "grapes",3.85}
- };
- Dictionary<string, double> pricesWeekend = new Dictionary<string, double>
- { { "banana", 2.70 }, { "apple",1.25}, { "orange",0.90},
- {"grapefruit",1.60}, {"kiwi",3.00}, { "pineapple",5.60}, { "grapes",4.20}
- };
- if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thirsday" || day == "friday")
- {
- price = quantity * pricesWeek[fruit];
- Console.WriteLine("{0:f2}", price);
- else Console.WriteLine("error");
- }
- else if (day=="saturday" || day=="sunday")
- {
- price = quantity * pricesWeekend[fruit];
- Console.WriteLine("{0:f2}", price);
- else Console.WriteLine("error");
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement