Adapted from Text problem 15.7 The following program manages flight reservations for Golden Nuggets Airline. Golden Nuggets has only one plane with N_SEATS seats for passengers. This program processes ticket reservation requests from the airline's website.
- The command R requests a reservation. If there is a seat available, the reservation is approved. If there are no seats, the reservation is denied.
- Subsequently, a passenger with a reservation can purchase a ticket using the P command. This means that for every P command, there must be a preceding R command; however, not every R will materialize into a purchased ticket.
- The program ends when the X command is entered.
Following is the program, but it contains serious design errors. Consider the possibilities of:
- Specification error (does the specification handle any possible sequence of R's and P's ?)
- Algorithm error (does the code implement the specification; again, consider any possible sequence of R's and P's)
A. Identify the errors, including at least one specification error, and at least one algorithm error.
- Keep in mind that specification errors include specifications that are incomplete.