fbinnzhivko

02.SmallShop

Mar 5th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         var product = Console.ReadLine().ToLower();
  8.         var city = Console.ReadLine().ToLower();
  9.         var quantity = double.Parse(Console.ReadLine());
  10.         var prize = 0.0;
  11.         if (city == "sofia")
  12.         {
  13.             if (product == "coffee") { prize = 0.50; }
  14.             else if (product == "water") { prize = 0.80; }
  15.             else if (product == "beer") { prize = 1.20; }
  16.             else if (product == "sweets") { prize = 1.45; }
  17.             else if (product == "peanuts") { prize = 1.60; }
  18.  
  19.         }
  20.         else if (city == "plovdiv")
  21.         {
  22.             if (product == "coffee") { prize = 0.40; }
  23.             else if (product == "water") { prize = 0.70; }
  24.             else if (product == "beer") { prize = 1.15; }
  25.             else if (product == "sweets") { prize = 1.30; }
  26.             else if (product == "peanuts") { prize = 1.50; }
  27.         }
  28.         else if (city == "varna")
  29.         {
  30.             if (product == "coffee") { prize = 0.45; }
  31.             else if (product == "water") { prize = 0.70; }
  32.             else if (product == "beer") { prize = 1.10; }
  33.             else if (product == "sweets") { prize = 1.35; }
  34.             else if (product == "peanuts") { prize = 1.55; }
  35.         }
  36.         Console.WriteLine("{0}", quantity * prize);
  37.     }
  38. }
Add Comment
Please, Sign In to add comment