Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp26
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string city = Console.ReadLine();
  10.             double sells = double.Parse(Console.ReadLine());
  11.             double commision = 0;
  12.             if (city == "Sofia")
  13.             {
  14.                 if (sells >= 0 && sells <= 500)
  15.                 {
  16.                     commision = sells * 0.05;
  17.                     Console.WriteLine($"{commision:f2}");
  18.                 }
  19.                 else if (sells > 500 && sells <= 1000)
  20.                 {
  21.                     commision = sells * 0.07;
  22.                     Console.WriteLine($"{commision:f2}");
  23.                 }
  24.                 else if (sells > 1000 && sells <= 10000)
  25.                 {
  26.                     commision = sells * 0.08;
  27.                     Console.WriteLine($"{commision:f2}");
  28.  
  29.                 }
  30.                 else if (sells > 10000)
  31.                 {
  32.                     commision = sells * 0.12;
  33.                     Console.WriteLine($"{commision:f2}");
  34.                 }
  35.             }
  36.             else if (city == "Varna")
  37.             {
  38.                 if (sells >= 0 && sells <= 500)
  39.                 {
  40.                     commision = sells * 0.045;
  41.                     Console.WriteLine($"{commision:f2}");
  42.                 }
  43.                 else if (sells > 500 && sells <= 1000)
  44.                 {
  45.                     commision = sells * 0.075;
  46.                     Console.WriteLine($"{commision:f2}");
  47.                 }
  48.                 else if (sells > 1000 && sells <= 10000)
  49.                 {
  50.                     commision = sells * 0.1;
  51.                     Console.WriteLine($"{commision:f2}");
  52.                 }
  53.                 else if (sells > 10000)
  54.                 {
  55.                     commision = sells * 0.13;
  56.                     Console.WriteLine($"{commision:f2}");
  57.                 }
  58.                 else
  59.                 {
  60.                     Console.WriteLine("error");
  61.                 }
  62.             }
  63.  
  64.             else if (city == "Plovdiv")
  65.             {
  66.                 if (sells >= 0 && sells <= 500)
  67.                 {
  68.                     commision = sells * 0.055;
  69.                     Console.WriteLine($"{commision:f2}");
  70.                 }
  71.                 else if (sells > 500 && sells <= 1000)
  72.                 {
  73.                     commision = sells * 0.08;
  74.                     Console.WriteLine($"{commision:f2}");
  75.                 }
  76.                 else if (sells > 1000 && sells <= 10000)
  77.                 {
  78.                     commision = sells * 0.12;
  79.                     Console.WriteLine($"{commision:f2}");
  80.                 }
  81.                 else if (sells > 10000)
  82.                 {
  83.                     commision = sells * 0.145;
  84.                     Console.WriteLine($"{commision:f2}");
  85.                 }
  86.                 else
  87.                 {
  88.                     Console.WriteLine("error");
  89.                 }
  90.  
  91.             }
  92.             else if (city != "Sofia" && city != "Varna" && city != "Plovdiv")
  93.             {
  94.                 Console.WriteLine("error");
  95.             }
  96.  
  97.             }
  98.         }
  99.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement