Advertisement
Guest User

08. Trade Comissions

a guest
Oct 8th, 2017
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TradeComissions
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string city = Console.ReadLine().ToLower();
  14.             decimal p = decimal.Parse(Console.ReadLine());
  15.             decimal kom = 0;
  16.  
  17.             if (city=="sofia")
  18.             {
  19.                 if (p >= 0 && p <= 500)
  20.                     kom = 0.05m * p;
  21.  
  22.                 else if (p > 500 && p <= 1000)
  23.                     kom = 0.07m * p;
  24.  
  25.                 else if (p > 1000 && p <= 10000)
  26.                     kom = 0.08m * p;
  27.  
  28.                 else if (p > 10000)
  29.                     kom = 0.12m * p;
  30.             }
  31.  
  32.             else if (city == "varna")
  33.             {
  34.                 if (p >= 0 && p <= 500)
  35.                     kom = 0.045m * p;
  36.  
  37.                 else if (p > 500 && p <= 1000)
  38.                     kom = 0.075m * p;
  39.  
  40.                 else if (p > 1000 && p <= 10000)
  41.                     kom = 0.1m * p;
  42.  
  43.                 else if (p > 10000)
  44.                     kom = 0.13m * p;
  45.             }
  46.  
  47.             else if (city == "plovdiv")
  48.             {
  49.                 if (p >= 0 && p <= 500)
  50.                     kom = 0.055m * p;
  51.  
  52.                 else if (p > 500 && p <= 1000)
  53.                     kom = 0.08m * p;
  54.  
  55.                 else if (p > 1000 && p <= 10000)
  56.                     kom = 0.12m * p;
  57.  
  58.                 else if (p > 10000)
  59.                     kom = 0.145m * p;
  60.             }
  61.  
  62.             if(kom!=0)
  63.                 Console.WriteLine(kom);
  64.  
  65.             else
  66.                 Console.WriteLine("error");
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement