4.0k views
2 votes
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.

1 Answer

1 vote

Final answer:

The provided program for managing flight reservations contains a specification error and an algorithm error.

Step-by-step explanation:

The errors in the provided program for managing flight reservations are:

  1. Specification error: The specification does not handle all possible sequences of R's and P's. It does not specify what happens when a P command is entered without a preceding R command.
  2. Algorithm error: The code does not implement the specification correctly. It does not properly track the number of available seats and does not enforce the requirement that every P command must have a preceding R command.

User Brutallord
by
6.7k points