Can anyone help me please! I want the source code for this program.!! Tomorrow is last date of submitting C++ PROJECT. I want the source code for this program.!!

Airline Reservations System

A small airline has just purchased a computer for its new automated reservations system.
You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Display the following alternatives: Please type 1 for First Class and Please type 2 for Economy.
If the user types 1, your app should assign a seat in the first-class section (seats 1–5).
If the user types 2, your app should assign a seat in the economy section (seats 6–10).
Use a one-dimensional array of type bool to represent the seating chart of the plane.
Initialize all the elements of the array to false to indicate that all the seats are empty.
As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available.
Your app should never assign a seat that has already been assigned. When the economy section is full, your app should ask the person if it’s acceptable to be placed in the first-class section (and vice versa).
If yes, make the appropriate seat assignment. If no, display the message “Next flight leaves in 3 hours.”

Dani AI

Generated

— given the deadline pressure and the blunt but valid points from and about learning the assignment, the following is a short, readable C++ reference implementation provided for study and adaptation (not as a drop-in submission). ’s note about paid services is a reminder that outsourcing carries academic and practical risks.

Implementation notes: represent the 10 seats with a bool seats[10], keep seat-indexing 0-based internally and add 1 when printing, search for the first free seat in a class range, offer the alternate class when the requested section is full, and handle invalid/non-numeric input so the program doesn’t hang or loop unexpectedly.

#include <iostream>
#include <limits>

using namespace std;
const int TOTAL = 10;

int findSeat(bool seats[], int a, int b) {
  for (int i = a; i <= b; ++i) if (!seats[i]) return i;
  return -1;
}

bool full(bool seats[]) {
  for (int i = 0; i < TOTAL; ++i) if (!seats[i]) return false;
  return true;
}

void printPass(int idx) {
  cout << "Boarding pass - Seat " << (idx + 1)
       << (idx < 5 ? " (First Class)\n" : " (Economy)\n");
}

int main() {
  bool seats[TOTAL] = { false };
  while (!full(seats)) {
    cout << "Type 1 for First Class or 2 for Economy: ";
    int choice;
    if (!(cin >> choice)) {
      cin.clear();
      cin.ignore(numeric_limits<streamsize>::max(), '\n');
      cout << "Invalid input; enter 1 or 2.\n";
      continue;
    }

    int seat = (choice == 1) ? findSeat(seats, 0, 4) : (choice == 2 ? findSeat(seats, 5, 9) : -1);
    if (seat != -1) { seats[seat] = true; printPass(seat); continue; }

    int altStart = (choice == 1) ? 5 : 0, altEnd = (choice == 1) ? 9 : 4;
    int alt = findSeat(seats, altStart, altEnd);
    if (alt != -1) {
      cout << "Requested class full. Accept other class? (y/n): ";
      char ans; cin >> ans;
      if (ans == 'y' || ans == 'Y') { seats[alt] = true; printPass(alt); }
      else cout << "Next flight leaves in 3 hours.\n";
    } else { cout << "Plane full. Next flight leaves in 3 hours.\n"; break; }
  }

  if (full(seats)) cout << "All seats assigned. Next flight leaves in 3 hours.\n";
  return 0;
}

Quick testing and pitfalls: compile with g++ -std=c++11 -o airline airline.cpp; test filling a section, declining the alternate class, and entering non-numeric input. Watch for off-by-one errors (index vs printed seat number) and for not clearing cin after bad reads. This example is intended as an instructional reference — submitting others’ code as one’s own can violate course policies.

Recommended Answers

All 3 Replies

IF your plan is to do nothing, wait until the day before the cutoff, then expect someone else to drop everything and do it for you...
... then nobody here is qualified to give you the kindof help you really need.

that's not how the world works, kid.
You do your own work, and only when you are stuck you ask detailed questions about parts of the implementation you have problems with.
You do NOT ask other people to do your homework for you.

And oh, any airline who in 2021 buy their first computer and then expect to write an entire reservations system from scratch deserves to fail just as much as a kid who expects other people to do their homework for them deserves to fail.

If you really insist on cheating, you can pay someone to do tour homework for you on services such as Fiverr I guess??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.