Advertisement
Guest User

SmallShop

a guest
Jul 4th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.48 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class Program
  5. {
  6.     static void Main()
  7.     {
  8.         string product = Console.ReadLine().ToLower(), town = Console.ReadLine().ToLower();
  9.         float quantity = float.Parse(Console.ReadLine());
  10.         /*град / продукт coffee  water   beer    sweets  peanuts
  11.  
  12.         Sofia               0.50    0.80    1.20    1.45    1.60
  13.         Plovdiv             0.40    0.70    1.15    1.30    1.50
  14.         Varna               0.45    0.70    1.10    1.35    1.55*/
  15.  
  16.         if (town == "sofia")
  17.         {
  18.             if (product == "coffee")
  19.             {
  20.                 Console.WriteLine(0.50 * quantity);
  21.             }
  22.             else if (product == "water")
  23.             {
  24.                 Console.WriteLine(0.80 * quantity);
  25.             }
  26.             else if (product == "beer")
  27.             {
  28.                 Console.WriteLine(1.20 * quantity);
  29.             }
  30.             else if (product == "sweets")
  31.             {
  32.                 Console.WriteLine(1.45 * quantity);
  33.             }
  34.             else if (product == "peanuts")
  35.             {
  36.                 Console.WriteLine(1.60 * quantity);
  37.             }
  38.  
  39.         }
  40.         if (town == "plovdiv")
  41.         {
  42.             if (product == "coffee")
  43.             {
  44.                 Console.WriteLine(0.40 * quantity);
  45.             }
  46.             else if (product == "water")
  47.             {
  48.                 Console.WriteLine(0.70 * quantity);
  49.             }
  50.             else if (product == "beer")
  51.             {
  52.                 Console.WriteLine(1.15 * quantity);
  53.             }
  54.             else if (product == "sweets")
  55.             {
  56.                 Console.WriteLine(1.30 * quantity);
  57.             }
  58.             else if (product == "peanuts")
  59.             {
  60.                 Console.WriteLine(1.50 * quantity);
  61.             }
  62.         }
  63.         if (town == "varna")
  64.         {
  65.             if (product == "coffee")
  66.             {
  67.                 Console.WriteLine(0.45 * quantity);
  68.             }
  69.             else if (product == "water")
  70.             {
  71.                 Console.WriteLine(0.70 * quantity);
  72.             }
  73.             else if (product == "beer")
  74.             {
  75.                 Console.WriteLine(1.10 * quantity);
  76.             }
  77.             else if (product == "sweets")
  78.             {
  79.                 Console.WriteLine(1.35 * quantity);
  80.             }
  81.             else if (product == "peanuts")
  82.             {
  83.                 Console.WriteLine(1.55 * quantity);
  84.             }
  85.         }
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement