Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Reservation caluclations - ignore cin

JOHNYTHEWINNER Jan 26th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7.  
  8.  
  9. int main()
  10. {
  11.     int days;
  12.     cin >> days;
  13.     cin.ignore();
  14.     int nights = days - 1;
  15.     string room;
  16.     getline (cin, room);
  17.    
  18.     string evaluation;
  19.     getline (cin, evaluation);
  20.     int roomprice = 18;
  21.     int apartmentprice = 25;
  22.     int presidentprice = 35;
  23.  
  24.  
  25.  
  26.     if (nights < 10)
  27.     {
  28.         if (room == "room for one person")
  29.         {
  30.             if (evaluation == "positive")
  31.             {
  32.                 cout << fixed << setprecision(2) << ((nights * roomprice) + (nights * roomprice) * 0.25) << endl;
  33.             }
  34.             else
  35.             {
  36.                 cout << fixed << setprecision(2) << (nights * roomprice)*0.9 << endl;
  37.             }
  38.  
  39.         }
  40.         if (room == "apartment")
  41.         {
  42.             if (evaluation == "positive")
  43.             {
  44.                 cout << fixed << setprecision(2) << ((nights * apartmentprice)*0.7 + (nights * apartmentprice)*0.7 * 0.25) << endl;
  45.             }
  46.             else
  47.             {
  48.                 cout << fixed << setprecision(2) << (nights * apartmentprice)*0.7*0.9 << endl;
  49.             }
  50.         }
  51.         if (room == "president apartment")
  52.         {
  53.             if (evaluation == "positive")
  54.             {
  55.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.9 + (nights * presidentprice) * 0.9 * 0.25) << endl;
  56.             }
  57.             else
  58.             {
  59.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.9)*0.9 << endl;
  60.             }
  61.         }
  62.     }
  63.     if (nights >= 10 && nights < 15)
  64.     {
  65.         if (room == "room for one person")
  66.         {
  67.             if (evaluation == "positive")
  68.             {
  69.                 cout << fixed << setprecision(2) << ((nights * roomprice) + (nights * roomprice) * 0.25) << endl;
  70.             }
  71.             else
  72.             {
  73.                 cout << fixed << setprecision(2) << (nights * roomprice) * 0.9 << endl;
  74.             }
  75.  
  76.         }
  77.         if (room == "apartment")
  78.         {
  79.             if (evaluation == "positive")
  80.             {
  81.                 cout << (nights * apartmentprice) << endl;
  82.                 cout << fixed << setprecision(2) << ((nights * apartmentprice)*0.65) + ((nights * apartmentprice)*0.65*0.25) << endl;
  83.             }
  84.             else
  85.             {
  86.                 cout << fixed << setprecision(2) << (nights * apartmentprice)*0.65 * 0.9 << endl;
  87.             }
  88.         }
  89.         if (room == "president apartment")
  90.         {
  91.             if (evaluation == "positive")
  92.             {
  93.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.85 + (nights * presidentprice) * 0.85 * 0.25) << endl;
  94.             }
  95.             else
  96.             {
  97.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.85) * 0.9 << endl;
  98.             }
  99.         }
  100.     }
  101.     if (nights >= 15)
  102.     {
  103.         if (room == "room for one person")
  104.         {
  105.             if (evaluation == "positive")
  106.             {
  107.                 cout << fixed << setprecision(2) << ((nights * roomprice) + (nights * roomprice) * 0.25) << endl;
  108.             }
  109.             else
  110.             {
  111.                 cout << fixed << setprecision(2) << (nights * roomprice) * 0.9 << endl;
  112.             }
  113.  
  114.         }
  115.         if (room == "apartment")
  116.         {
  117.             if (evaluation == "positive")
  118.             {
  119.                 cout << fixed << setprecision(2) << ((nights * apartmentprice) * 0.5 + (nights * apartmentprice) * 0.5 * 0.25) << endl;
  120.             }
  121.             else
  122.             {
  123.                 cout << fixed << setprecision(2) << (nights * apartmentprice) * 0.5 * 0.9 << endl;
  124.             }
  125.         }
  126.         if (room == "president apartment")
  127.         {
  128.             if (evaluation == "positive")
  129.             {
  130.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.8 + (nights * presidentprice) * 0.8 * 0.25) << endl;
  131.             }
  132.             else
  133.             {
  134.                 cout << fixed << setprecision(2) << ((nights * presidentprice) * 0.8) * 0.9 << endl;
  135.             }
  136.         }
  137.  
  138.     }
  139.  
  140.     return 0;
  141. }
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
Top