Advertisement
JOHNYTHEWINNER

Commissions

Jan 26th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6.  
  7. int main()
  8. {
  9.     string city;
  10.     double value;
  11.     cin >> city;
  12.     cin >> value;
  13.     if (value >= 0 && value <= 500)
  14.     {
  15.         if (city == "Sofia")
  16.         {
  17.             cout << fixed << setprecision(2) << (value * 0.05) << endl;
  18.         }
  19.         else if (city == "Varna")
  20.         {
  21.             cout << fixed << setprecision(2) << (value * 0.045) << endl;
  22.         }
  23.         else if (city == "Plovdiv")
  24.         {
  25.             cout << fixed << setprecision(2) << (value * 0.055) << endl;
  26.         }
  27.         else
  28.         {
  29.             cout << "error" << endl;
  30.         }
  31.     }
  32.     if (value > 500 && value <= 1000)
  33.     {
  34.         if (city == "Sofia")
  35.         {
  36.             cout << fixed << setprecision(2) << (value * 0.07) << endl;
  37.         }
  38.         else if (city == "Varna")
  39.         {
  40.             cout << fixed << setprecision(2) << (value * 0.075) << endl;
  41.         }
  42.         else if (city == "Plovdiv")
  43.         {
  44.             cout << fixed << setprecision(2) << (value * 0.08) << endl;
  45.         }
  46.         else
  47.         {
  48.             cout << "error" << endl;
  49.         }
  50.     }
  51.  
  52.     if (value > 1000 && value <= 10000)
  53.     {
  54.         if (city == "Sofia")
  55.         {
  56.             cout << fixed << setprecision(2) << (value * 0.08) << endl;
  57.         }
  58.         else if (city == "Varna")
  59.         {
  60.             cout << fixed << setprecision(2) << (value * 0.1) << endl;
  61.         }
  62.         else if (city == "Plovdiv")
  63.         {
  64.             cout << fixed << setprecision(2) << (value * 0.12) << endl;
  65.         }
  66.         else
  67.         {
  68.             cout << "error" << endl;
  69.         }
  70.  
  71.     }
  72.     if (value > 10000)
  73.     {
  74.  
  75.         if (city == "Sofia")
  76.         {
  77.             cout << fixed << setprecision(2) << (value * 0.12) << endl;
  78.         }
  79.         else if (city == "Varna")
  80.         {
  81.         cout << fixed << setprecision(2) << (value * 0.13) << endl;
  82.         }
  83.         else if (city == "Plovdiv")
  84.         {
  85.         cout << fixed << setprecision(2) << (value * 0.145) << endl;
  86.         }
  87.         else
  88.         {
  89.             cout << "error" << endl;
  90.         }
  91.    
  92.     }
  93.     if     (value<0)
  94.     {
  95.         cout << "error" << endl;
  96.     }
  97.    
  98.    
  99.  
  100.     return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement