Guest User

Untitled

a guest
Nov 5th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.35 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.             double money = double.Parse(Console.ReadLine());
  15.             var result = 0.0;
  16.             if (city=="sofia")
  17.             {
  18.                 if (money >= 0 && money <= 500)
  19.                 {
  20.                     result = money * 0.05;
  21.                 }
  22.                 else if (money > 500 && money <= 1000)
  23.                 {
  24.                     result = money * 0.07;
  25.                 }
  26.                 else if (money > 1000 && money <= 10000)
  27.                 {
  28.                     result = money * 0.08;
  29.                 }
  30.                 else if (money > 10000)
  31.                 {
  32.                     result = money * 0.12;
  33.                 }
  34.  
  35.             }
  36.             else if (city=="plovdiv")
  37.             {
  38.                 if (money >= 0 && money <= 500)
  39.                 {
  40.                     result = money * 0.055;
  41.                 }
  42.                 else if (money > 500 && money <= 1000)
  43.                 {
  44.                     result = money * 0.08;
  45.                 }
  46.                 else if (money > 1000 && money <= 10000)
  47.                 {
  48.                     result = money * 0.12;
  49.                 }
  50.                 else if (money > 10000)
  51.                 {
  52.                     result = money * 0.145;
  53.                 }
  54.             }
  55.             else if (city=="varna")
  56.             {
  57.                 if (money >= 0 && money <= 500)
  58.                 {
  59.                     result = money * 0.045;
  60.                 }
  61.                 else if (money > 500 && money <= 1000)
  62.                 {
  63.                     result = money * 0.075;
  64.                 }
  65.                 else if (money > 1000 && money <= 10000)
  66.                 {
  67.                     result = money * 0.1;
  68.                 }
  69.                 else if (money > 10000)
  70.                 {
  71.                     result = money * 0.13;
  72.                 }
  73.             }
  74.             if (result!=0)
  75.             {
  76.                 Console.WriteLine("{0:f2}", result);
  77.             }
  78.             else
  79.             {
  80.                 Console.WriteLine("error");
  81.             }
  82.         }
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment