Advertisement
jhnksr

codecodecode

Oct 10th, 2023 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 14.07 KB | Source Code | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     char bclass, mpref, spref, memb, spreq, dof;
  10.     string conf, email, name, sbclass, date, sdate, smpref, sspref, smemb, sspreq, sdof;
  11.  
  12.     int clOffer = 0, dateOffer = 0, mealOffer = 0, seatOffer = 0, membOffer = 0, specOffer = 0, duraOffer = 0;
  13.     int clCon = 0, specCon = 0, duraCon = 0;
  14.  
  15.     cout << "Welcome to SkySail Airlines!" << endl << endl << endl;
  16.  
  17.     while (true) {
  18.         cout << "Do you want to book a ticket? (Yes/No): ";
  19.         cin >> conf;
  20.  
  21.         if (conf == "No" || conf == "N" || conf == "n" || conf == "no") {
  22.             system("cls");
  23.             cout << "We would love to fly with you soon!\n\n" << endl;
  24.             break;
  25.         }
  26.         else if (conf == "Yes" || conf == "Y" || conf == "y" || conf == "yes" || conf == "ye") {
  27.             system("cls");
  28.             cout << "Loading options...\n\n";
  29.             Sleep(3000);
  30.             system("cls");
  31.  
  32.             cin.ignore();
  33.             cout << "SkySail Airlines Reservation System" << endl << endl;
  34.  
  35.             cout << "Booking Class" << endl << endl;
  36.             cout << "1. [F]irst Class\n2. [B]usiness\n3. [P]remium Economy\n4. [E]conomy" << endl << endl;
  37.             cin >> bclass;
  38.             system("cls");
  39.  
  40.             switch (bclass) {
  41.             case '1':
  42.             case 'F':
  43.             case 'f':
  44.                 sbclass = "First Class";
  45.                 clOffer = 1;
  46.                 break;
  47.  
  48.             case '2':
  49.             case 'B':
  50.             case 'b':
  51.                 sbclass = "Business";
  52.                 clOffer = 2;
  53.                 break;
  54.  
  55.             case '3':
  56.             case 'P':
  57.             case 'p':
  58.                 sbclass = "Premium Economy";
  59.                 clOffer = 3;
  60.                 break;
  61.  
  62.             case '4':
  63.             case 'E':
  64.             case 'e':
  65.                 sbclass = "Economy";
  66.                 clOffer = 4;
  67.                 break;
  68.  
  69.             default:
  70.                 cout << "Invalid selection. Please choose a valid option." << endl;
  71.                 continue;
  72.             }
  73.  
  74.             system("cls");
  75.  
  76.             cout << "SkySail Airlines Reservation System" << endl << endl;
  77.  
  78.             cout << "Enter the date of flight (MM/DD/YYYY): ";
  79.             cin >> date;
  80.  
  81.             string monthStr = date.substr(0, 2);
  82.             int month = stoi(monthStr);
  83.  
  84.             if ((month >= 1 && month <= 4) || (month >= 10 && month <= 12)) {
  85.                 sdate = "Peak";
  86.                 dateOffer = 1;
  87.             }
  88.             else if (month >= 6 && month <= 9) {
  89.                 sdate = "Off-peak";
  90.                 dateOffer = 0;
  91.             }
  92.             else {
  93.                 cout << "Invalid month. Please enter a valid date in the format MM/DD/YYYY." << endl;
  94.                 continue;
  95.             }
  96.  
  97.             system("cls");
  98.  
  99.             cout << "SkySail Airlines Reservation System" << endl << endl;
  100.             cout << "What type of meal set would you prefer?" << endl;
  101.             cout << "1. [N]on-vegetarian\n2. [Ve]getarian\n3. [V]egan\n4. [G]luten-free\n\n";
  102.             cin >> mpref;
  103.  
  104.             switch (mpref) {
  105.             case '1':
  106.             case 'N':
  107.             case 'n':
  108.                 smpref = "Non-vegetarian";
  109.                 mealOffer = 1;
  110.                 break;
  111.  
  112.             case '2':
  113.             case 'VE':
  114.             case 've':
  115.             case 'Ve':
  116.                 smpref = "Vegetarian";
  117.                 mealOffer = 2;
  118.                 break;
  119.  
  120.             case '3':
  121.             case 'V':
  122.             case 'v':
  123.                 smpref = "Vegan";
  124.                 mealOffer = 3;
  125.                 break;
  126.  
  127.             case '4':
  128.             case 'G':
  129.             case 'g':
  130.                 smpref = "Gluten-free";
  131.                 mealOffer = 4;
  132.                 break;
  133.  
  134.             default:
  135.                 cout << "Invalid selection. Please choose a valid option." << endl;
  136.                 continue;
  137.             }
  138.  
  139.             system("cls");
  140.  
  141.             cout << "SkySail Airlines Reservation System" << endl << endl;
  142.             cout << "What seat position would you like? " << endl;
  143.             cout << "1. [A]isle\n2. [W]indow\n3. [M]iddle" << endl << endl;
  144.             cin >> spref;
  145.  
  146.             switch (spref) {
  147.             case '1':
  148.             case 'A':
  149.             case 'a':
  150.                 sspref = "Aisle";
  151.                 seatOffer = 1;
  152.                 break;
  153.  
  154.             case '2':
  155.             case 'W':
  156.             case 'w':
  157.                 sspref = "Window";
  158.                 seatOffer = 2;
  159.                 break;
  160.  
  161.             case '3':
  162.             case 'M':
  163.             case 'm':
  164.                 sspref = "Middle";
  165.                 seatOffer = 3;
  166.                 break;
  167.  
  168.             default:
  169.                 cout << "Invalid selection. Please choose a valid option." << endl;
  170.                 continue;
  171.             }
  172.  
  173.             system("cls");
  174.  
  175.             cout << "SkySail Airlines Reservation System" << endl << endl;
  176.             cout << "Special Requirements" << endl;
  177.             cout << "1. [W]heelchair Access\n2. Near [R]estroom\n3. Extra [L]egroom\n4. [N]o Special Requirements\n" << endl;
  178.             cin >> spreq;
  179.  
  180.             switch (spreq) {
  181.             case '1':
  182.             case 'W':
  183.             case 'w':
  184.                 sspreq = "Wheelchair Access";
  185.                 specOffer = 1;
  186.                 break;
  187.  
  188.             case '2':
  189.             case 'R':
  190.             case 'r':
  191.                 sspreq = "Near Restroom";
  192.                 specOffer = 2;
  193.                 break;
  194.  
  195.             case '3':
  196.             case 'L':
  197.             case 'l':
  198.                 sspreq = "Extra Legroom";
  199.                 specOffer = 3;
  200.                 break;
  201.  
  202.             case '4':
  203.             case 'N':
  204.             case 'n':
  205.                 sspreq = "No Special Requirements";
  206.                 specOffer = 4;
  207.                 break;
  208.  
  209.             default:
  210.                 cout << "Invalid selection. Please choose a valid option." << endl;
  211.                 continue;
  212.             }
  213.  
  214.             system("cls");
  215.  
  216.             cout << "SkySail Airlines Reservation System" << endl << endl;
  217.             cout << "How long would you want to travel?" << endl;
  218.             cout << "1. [S]hort-haul\n2. [M]edium-haul\n3. [L]ong-haul\n\n";
  219.             cin >> dof;
  220.  
  221.             switch (dof) {
  222.             case '1':
  223.             case 'S':
  224.             case 's':
  225.                 sdof = "Short-haul";
  226.                 duraOffer = 1;
  227.                 break;
  228.  
  229.             case '2':
  230.             case 'M':
  231.             case 'm':
  232.                 sdof = "Medium-haul";
  233.                 duraOffer = 2;
  234.                 break;
  235.  
  236.             case '3':
  237.             case 'L':
  238.             case 'l':
  239.                 sdof = "Long-haul";
  240.                 duraOffer = 3;
  241.                 break;
  242.  
  243.             default:
  244.                 cout << "Invalid selection. Please choose a valid option." << endl;
  245.                 continue;
  246.             }
  247.  
  248.             system("cls");
  249.  
  250.             cout << "SkySail Airlines Reservation System" << endl << endl;
  251.             cout << "Loyalty Membership" << endl;
  252.             cout << "1. [G]old\n2. [S]ilver\n3. [B]ronze\n4. [N]one\n" << endl;
  253.             cin >> memb;
  254.  
  255.             switch (memb)
  256.             {
  257.             case '1':
  258.             case 'G':
  259.             case 'g':
  260.                 smemb = "Gold";
  261.                 membOffer = 1;
  262.                 break;
  263.  
  264.             case '2':
  265.             case 'S':
  266.             case 's':
  267.                 smemb = "Silver";
  268.                 membOffer = 2;
  269.                 break;
  270.  
  271.             case '3':
  272.             case 'B':
  273.             case 'b':
  274.                 smemb = "Bronze";
  275.                 membOffer = 3;
  276.                 break;
  277.  
  278.             case '4':
  279.             case 'N':
  280.             case 'n':
  281.                 smemb = "Unavailable";
  282.                 membOffer = 4;
  283.                 break;
  284.  
  285.             default:
  286.                 cout << "Invalid selection. Please choose a valid option." << endl;
  287.                 break;
  288.             }
  289.  
  290.             system("cls");
  291.             cout << "Fetching your selected details...\n\n\n\n";
  292.             Sleep(4000);
  293.             system("cls");
  294.  
  295.             cout << "SkySail Airlines Reservation System" << endl << endl;
  296.             cout << "Selected seat class: " << sbclass << "\t\t" << "Flying on " << date << endl << endl;
  297.  
  298.             cout << "Preferred meal set: " << smpref << "\t\t" << "Seat preference: " << sspref << endl;
  299.             cout << "Duration of flight: " << sdof << "\t\t\n" << "Special Requirements: " << sspreq << endl << endl;
  300.  
  301.             cout << smemb << " Membership" << endl << endl << endl;
  302.  
  303.             cout << "Due to your selected flight conditions, you have been granted with the following offers!" << endl << endl;
  304.  
  305.             if (clOffer == 1) {
  306.                 if (membOffer == 1) clCon = 2;
  307.                 else clCon = 1;
  308.             }
  309.             else if (clOffer == 2 && (membOffer == 1 || membOffer == 2)) {
  310.                 clCon = 3;
  311.             }
  312.             else if (clOffer == 3 && dateOffer == 1) {
  313.                 clCon = 4;
  314.             }
  315.             else if (clOffer == 4) {
  316.                 if (seatOffer == 3 && membOffer == 3) clCon = 5;
  317.                 else if (seatOffer == 3) clCon = 6;
  318.                 else if (membOffer == 3) clCon = 7;
  319.             }
  320.  
  321.             switch (clCon) {
  322.             case 1:
  323.                 cout << "Free WiFi" << endl;
  324.                 break;
  325.             case 2:
  326.                 cout << "Free WiFi" << endl;
  327.                 cout << "Airport Lounge Access" << endl;
  328.                 break;
  329.             case 3:
  330.                 cout << "Priority Boarding" << endl;
  331.                 break;
  332.             case 4:
  333.                 cout << "Your next flight booking is discounted" << endl;
  334.                 break;
  335.             case 5:
  336.                 cout << "Free Neck Pillow" << endl;
  337.                 cout << "5% discount for in-flight meals" << endl;
  338.                 break;
  339.             case 6:
  340.                 cout << "Free Neck Pillow" << endl;
  341.                 break;
  342.             case 7:
  343.                 cout << "5% discount for in-flight meals" << endl;
  344.                 break;
  345.             }
  346.  
  347.             if (duraOffer == 3) {
  348.                 if (seatOffer == 1) duraCon = 2;
  349.                 else if (seatOffer == 2) duraCon = 3;
  350.                 else duraCon = 1;
  351.             }
  352.             else if (duraOffer == 2 && seatOffer == 1) {
  353.                 duraCon = 4;
  354.             }
  355.             else if (duraOffer == 1 && (mealOffer == 2 || mealOffer == 3)) {
  356.                 clCon = 4;
  357.             }
  358.  
  359.             switch (duraCon) {
  360.             case 1:
  361.                 cout << "Provided with a blanket and headphones" << endl;
  362.                 break;
  363.             case 2:
  364.                 cout << "Provided with a blanket and headphones" << endl;
  365.                 cout << "Free drink voucher" << endl;
  366.                 break;
  367.             case 3:
  368.                 cout << "Provided with a blanket and headphones" << endl;
  369.                 cout << "Sleeping kit" << endl;
  370.                 break;
  371.             case 4:
  372.                 cout << "Entertainment system with a charging port" << endl;
  373.                 break;
  374.             }
  375.  
  376.             if (specOffer != 4) {
  377.                 cout << "\n\nDue to having " << sspreq << " requirement. We will provide you with ";
  378.  
  379.                 if (specOffer == 1) {
  380.                     cout << "ground staff assistance during boarding and de-boarding and seats close to the entrance" << endl;
  381.                 }
  382.                 else if (specOffer == 2) {
  383.                     cout << "seats near the restroom" << endl;
  384.                 }
  385.                 else if (specOffer == 3) {
  386.                     cout << "availability for front-row seats" << endl;
  387.                 }
  388.             }
  389.             else
  390.  
  391.                 cout << " ";
  392.  
  393.             cout << "\n\nConfirm your details and ticket. Enter your email address: ";
  394.             cin.ignore();
  395.             getline(cin, email);
  396.             cout << "\nEnter your name: ";
  397.             getline(cin, name);
  398.  
  399.  
  400.             system("cls");
  401.             cout << "Please wait..." << endl;
  402.             Sleep(1000);
  403.  
  404.             system("cls");
  405.             cout << "SkySail Airlines Reservation System" << endl;
  406.             cout << "\n\nSending the ticket to " << email << "..." << endl;
  407.  
  408.             Sleep(2000);
  409.             cout << "\nTicket sent to " << email << ". Thank you " << name << " for flying with SkySail Airlines!" << endl;
  410.  
  411.             cout << "\nWe're looking forward to flying with you again!" << endl;
  412.             break;
  413.         }
  414.     }
  415.  
  416.     return 0;
  417. }
  418.  
  419. /*
  420.  
  421. Conditions:
  422.  
  423. bclass(first class) = auto free wifi
  424. bclass(first class) && memb (gold) = airport lounge access
  425. bclass(economy) && spref(middle) = neck pillow
  426. bclass(business) && memb(silver||gold) = prio boarding
  427. bclass(premium economy) && dot(peak) = avail discount for next booking
  428. bclass(economy) && memb(bronze) = 5% discount on flight meal
  429.  
  430. dof(short-haul) && mpref(vegetarian||vegan) = offer snack box
  431. dof(medium-haul && spref(window) = es with charging port
  432. dof(long-haul) = blanket and headphones
  433. dof(long-haul) && spref(aisle)  = free drink voucher
  434. dof(long-haul) && spref(window)= sleeping kit
  435.  
  436.  
  437. mpref(vegan||gluten-free) = confirm meal 48 hours before flight
  438.  
  439. sreq(extra legroom) = always front-row seat
  440. sreq(wheelchair) = assistance, seat close to entrance
  441. sreq(near restroom) = not next to emergency exits
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449. /*Conditions
  450. Booking Class: Economy, Premium Economy, Business, First Class.
  451. ● Date of Travel: Determines peak or off-peak travel times.
  452. ● Meal Preference: Vegetarian, Non-Vegetarian, Vegan, Gluten-Free, etc.
  453. ● Seat Preference: Aisle, Window, or Middle.
  454. ● Loyalty Membership: Gold, Silver, Bronze, or None.
  455. ● Special Requirements: Wheelchair access, near restroom, extra legroom.
  456. ● Duration of Flight: Short-haul (< 3 hours), Medium-haul (3-6 hours), Long-haul (>
  457. 6 hours).
  458. */
  459.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement