Advertisement
Kuncavia

SmallShop

Nov 15th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.83 KB | None | 0 0
  1. using System;
  2.  
  3. class SmallShop
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         string productName = (Console.ReadLine());
  8.         string townName = (Console.ReadLine());
  9.         double quantity = double.Parse(Console.ReadLine());
  10.  
  11.         double productPrice = 0;
  12.         if (productName == "coffee")
  13.         {
  14.             if (townName == "Sofia")
  15.             {
  16.                 productPrice = quantity * 0.5;
  17.             }
  18.             else if (townName == "Plovdiv")
  19.             {
  20.                 productPrice = quantity * 0.4;
  21.             }
  22.             else if (townName == "Varna")
  23.             {
  24.                 productPrice = quantity * 0.45;
  25.             }
  26.         }
  27.         else if (productName == "water")
  28.         {
  29.             if (townName == "Sofia")
  30.             {
  31.                 productPrice = quantity * 0.8;
  32.             }
  33.             else if (townName == "Plovdiv")
  34.             {
  35.                 productPrice = quantity * 0.7;
  36.             }
  37.             else if (townName == "Varna")
  38.             {
  39.                 productPrice = quantity * 0.7;
  40.             }
  41.         }
  42.         else if (productName == "beer")
  43.         {
  44.             if (townName == "Sofia")
  45.             {
  46.                 productPrice = quantity * 1.2;
  47.             }
  48.             else if (townName == "Plovdiv")
  49.             {
  50.                 productPrice = quantity * 1.15;
  51.             }
  52.             else if (townName == "Varna")
  53.             {
  54.                 productPrice = quantity * 1.1;
  55.             }
  56.         }
  57.         else if (productName == "water")
  58.         {
  59.             if (townName == "Sofia")
  60.             {
  61.                 productPrice = quantity * 0.8;
  62.             }
  63.             else if (townName == "Plovdiv")
  64.             {
  65.                 productPrice = quantity * 0.7;
  66.             }
  67.             else if (townName == "Varna")
  68.             {
  69.                 productPrice = quantity * 0.7;
  70.             }
  71.         }
  72.         else if (productName == "sweets")
  73.         {
  74.             if (townName == "Sofia")
  75.             {
  76.                 productPrice = quantity * 1.45;
  77.             }
  78.             else if (townName == "Plovdiv")
  79.             {
  80.                 productPrice = quantity * 1.3;
  81.             }
  82.             else if (townName == "Varna")
  83.             {
  84.                 productPrice = quantity * 1.35;
  85.             }
  86.         }
  87.         else if (productName == "peanuts")
  88.         {
  89.             if (townName == "Sofia")
  90.             {
  91.                 productPrice = quantity * 1.6;
  92.             }
  93.             else if (townName == "Plovdiv")
  94.             {
  95.                 productPrice = quantity * 1.5;
  96.             }
  97.             else if (townName == "Varna")
  98.             {
  99.                 productPrice = quantity * 1.55;                  
  100.             }
  101.         }
  102.         Console.WriteLine(productPrice);
  103.     }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement