VelizarAvramov

HomeWork_Trade-Comissions

May 12th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.78 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 _08_bussinesComision
  8. {
  9.     class TradeComissions
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var town = Console.ReadLine().ToLower();
  14.             var s = double.Parse(Console.ReadLine());
  15.  
  16.             var comission = -1.00;
  17.  
  18.             if (town == "Sofia")
  19.             {
  20.                 if (0 <= s && s <= 500)
  21.                 {
  22.                     comission = 0.05; //Console.WriteLine("{0:f2}" , s * 0.05);
  23.                 }
  24.                 else if (500 < s && s <= 1000)
  25.                 {
  26.                     comission = 0.07; //Console.WriteLine("{0:f2}" , s * 0.07);
  27.                 }
  28.                 else if (1000 < s && s <= 10000)
  29.                 {
  30.                     comission = 0.08; //Console.WriteLine("{0:f2}", s * 0.08);
  31.                 }
  32.                 else if (s > 10000)
  33.                 {
  34.                     comission = 0.12; //Console.WriteLine("{0:f2}", s * 0.12);
  35.                 }
  36.             }
  37.             else if (town == "Varna")
  38.             {
  39.                 if (0 <= s && s <= 500)
  40.                 {
  41.                     comission = 0.045; //Console.WriteLine("{0:f2}", s * 0.045);
  42.                 }
  43.                 else if (500 < s && s <= 1000)
  44.                 {
  45.                     comission = 0.075; //Console.WriteLine("{0:f2}", s * 0.075);
  46.                 }
  47.                 else if (1000 < s && s <= 10000)
  48.                 {
  49.                     comission = 0.10; //Console.WriteLine("{0:f2}", s * 0.10);
  50.                 }
  51.                 else if (s > 10000)
  52.                 {
  53.                     comission = 0.13; //Console.WriteLine("{0:f2}", s * 0.13);
  54.                 }
  55.             }
  56.             else if (town == "Plovdiv")
  57.             {
  58.                 if (0 <= s && s <= 500)
  59.                 {
  60.                     comission = 0.055; //Console.WriteLine("{0:f2}", s * 0.055);
  61.                 }
  62.                 else if (500 < s && s <= 1000)
  63.                 {
  64.                     comission = 0.08; //Console.WriteLine("{0:f2}", s * 0.08);
  65.                 }
  66.                 else if (1000 < s && s <= 10000)
  67.                 {
  68.                     comission = 0.12; //Console.WriteLine("{0:f2}", s * 0.12);
  69.                 }
  70.                 else if (s > 10000)
  71.                 {
  72.                     comission = 0.145; //Console.WriteLine("{0:f2}", s * 0.145);
  73.                 }
  74.             }
  75.             if (comission >= 0)
  76.             {
  77.                 Console.WriteLine("{0:f2}" , s * comission);
  78.             }
  79.             else
  80.             {
  81.                 Console.WriteLine("error");
  82.             }
  83.             //Console.WriteLine("{0:f2}" , (s * comission));
  84.         }
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment