Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string product = Console.ReadLine(); // "coffee", "water", "beer", "sweets", "peanuts"
- string town = Console.ReadLine(); //"Sofia", "Plovdiv", "Varna"
- double quantity = double.Parse(Console.ReadLine());
- //КРАЙНА ЦЕНА = КОЛИЧЕСТВО(quantity) * ЦЕНА ЗА 1 ПРОДУКТ (price)
- double price = 0; //цена на продукта
- switch (town)
- {
- case "Sofia":
- //проверка за продукта в София
- if (product == "coffee")
- {
- price = 0.50;
- }
- else if (product == "water")
- {
- price = 0.80;
- }
- else if (product == "beer")
- {
- price = 1.20;
- }
- else if (product == "sweets")
- {
- price = 1.45;
- }
- else if (product == "peanuts")
- {
- price = 1.60;
- }
- break;
- case "Plovdiv":
- //проверка за продукта в Пловдив
- if (product == "coffee")
- {
- price = 0.40;
- }
- else if (product == "water")
- {
- price = 0.70;
- }
- else if (product == "beer")
- {
- price = 1.15;
- }
- else if (product == "sweets")
- {
- price = 1.30;
- }
- else if (product == "peanuts")
- {
- price = 1.50;
- }
- break;
- case "Varna":
- //проверка за продукта във Варна
- if (product == "coffee")
- {
- price = 0.45;
- }
- else if (product == "water")
- {
- price = 0.70;
- }
- else if (product == "beer")
- {
- price = 1.10;
- }
- else if (product == "sweets")
- {
- price = 1.35;
- }
- else if (product == "peanuts")
- {
- price = 1.55;
- }
- break;
- }
- //единична цена на продукта
- double finalPrice = quantity * price;
- Console.WriteLine(finalPrice);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement