Advertisement
krasio12356

AluminiumJoinery

Apr 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6.                                // Aluminium Joinery
  7. int main()
  8. {
  9.     string s;
  10.     getline(cin, s);
  11.     int count = stoi(s);
  12.     string type;
  13.     getline(cin, type);
  14.     string way;
  15.     getline(cin, way);
  16.     double price;
  17.     if (type == "90X130")
  18.     {
  19.         if (count > 60)
  20.         {
  21.             price = 110 * 0.92;
  22.         }
  23.         else if (count > 30)
  24.         {
  25.             price = 110 * 0.95;
  26.         }
  27.         else if (count >= 10)
  28.         {
  29.             price = 110;
  30.         }
  31.         else
  32.         {
  33.             printf("Invalid order\n");
  34.             return 0;
  35.         }
  36.     }
  37.     if (type == "100X150")
  38.     {
  39.         if (count > 80)
  40.         {
  41.             price = 140 * 0.9;
  42.         }
  43.         else if (count > 40)
  44.         {
  45.             price = 140 * 0.94;
  46.         }
  47.         else if (count >= 10)
  48.         {
  49.             price = 140;
  50.         }
  51.         else
  52.         {
  53.             printf("Invalid order\n");
  54.             return 0;
  55.         }
  56.     }
  57.     if (type == "130X180")
  58.     {
  59.         if (count > 50)
  60.         {
  61.             price = 190 * 0.88;
  62.         }
  63.         else if (count > 20)
  64.         {
  65.             price = 190 * 0.93;
  66.         }
  67.         else if (count >= 10)
  68.         {
  69.             price = 190;
  70.         }
  71.         else
  72.         {
  73.             printf("Invalid order\n");
  74.             return 0;
  75.         }
  76.     }
  77.     if (type == "200X300")
  78.     {
  79.         if (count > 50)
  80.         {
  81.             price = 250 * 0.86;
  82.         }
  83.         else if (count > 25)
  84.         {
  85.             price = 250 * 0.91;
  86.         }
  87.         else if (count >= 10)
  88.         {
  89.             price = 250;
  90.         }
  91.         else
  92.         {
  93.             printf("Invalid order\n");
  94.             return 0;
  95.         }
  96.     }
  97.     price = price * count;
  98.     if (way == "With delivery")
  99.     {
  100.         price = price + 60;
  101.     }
  102.     if (count > 99)
  103.     {
  104.         price = price * 0.96;
  105.     }
  106.     printf("%.2f BGN\n", price);
  107.     return 0;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement