SHARE
TWEET

Trade Comissions

a guest Jun 26th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7.     string city;
  8.     double sales, comission;
  9.     cin >> city >> sales;
  10.  
  11.     if (city == "Sofia"){
  12.         if (sales >= 0 && sales <= 500){
  13.             comission = 0.05;
  14.         } else if ( sales > 500 && sales <= 1000){
  15.             comission = 0.07;
  16.         } else if ( sales > 1000 && sales <= 10000){
  17.             comission = 0.08;
  18.         } else if ( sales > 10000){
  19.             comission = 0.12;
  20.         }
  21.     } else if (city == "Varna"){
  22.         if (sales >= 0 && sales <= 500){
  23.             comission = 0.045;
  24.         } else if ( sales > 500 && sales <= 1000){
  25.             comission =  0.075;
  26.         } else if ( sales > 1000 && sales <= 10000){
  27.             comission =  0.10;
  28.         } else if ( sales > 10000){
  29.             comission = 0.13;
  30.         }
  31.     } else if (city == "Plovdiv"){
  32.         if (sales >= 0 && sales <= 500){
  33.             comission =  0.055;
  34.         } else if ( sales > 500 && sales <= 1000){
  35.             comission =  0.08;
  36.         } else if ( sales > 1000 && sales <= 10000){
  37.             comission = 0.12;
  38.         } else if ( sales > 10000){
  39.             comission = 0.145;
  40.         }
  41.     } else {
  42.         comission = -50;
  43.     }
  44.  
  45.     if (comission >= 0){
  46.         cout.setf(ios::fixed);
  47.         cout.precision(2);
  48.         cout << comission * sales << endl;
  49.     } else {
  50.         cout << "error" << endl;
  51.     }
  52.  
  53. return 0;
  54.  
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top