CSC 2210, SPA 6: Ticketing

Problem Description

hall.zip contains the start of a program to read seating data for a small concert hall. The following input (available as in.1)

        1 $Jane
        2 Paula
        3 Eddie
        4 $Shawna
        5 $FriendlyGhost
        6 BookItNowTravel
        0 END
        5 8
          .  .  2  -  .  .  1  1
          3  3  6  6  6  6  6  6
          -  1  .  4  .  2  .  4
          .  .  .  .  .  .  .  .
          -  -  6  6  6  6  -  -
        r 0,1,2
        o 1,4
        r 3,6,5
first lists the patrons by id (1-6), terminated by the line 0 END. Next it captures the currently reserved seats. The 5 8 indicates the hall has 5 rows with 8 seating positions in each row. This is followed by the information for each row where

The hall seating is followed by a sequence of commands reflecting actions at the ticket booth. The 'r' command reserves seats; r 0,1,3 means reserving seat 1 in row 0 for patron #3. Both seats and rows start at 0. The 'o' commands open seats back up; o 1,4 means to open seat 4 in row 1.

The initial program contains skeleton code for reading the original seating, including a structure to hold the data for the hall (including a list of patrons). You will extend the program to read and process the 'r' and 'o' commands and print the final seating setup. Running the program on the above input will generate

        Original hall seating:
          .  .  2  -  .  .  1  1
          3  3  6  6  6  6  6  6
          -  1  .  4  .  2  .  4
          .  .  .  .  .  .  .  .
          -  -  6  6  6  6  -  -
        Reserving row 0, seat 1 for Paula
        Releasing row 1, seat 4 for BookItNowTravel
        Reserving row 3, seat 6 for FriendlyGhost

        Final hall seating:
          .  2  2  -  .  .  1  1
          3  3  6  6  .  6  6  6
          -  1  .  4  .  2  .  4
          .  .  .  .  .  .  5  .
          -  -  6  6  6  6  -  -

        Seats for donors:
        row 0, seat 6
        row 0, seat 7
        row 2, seat 1
        row 2, seat 3
        row 2, seat 7
        row 3, seat 6
This output is available as out.1. Note this program follows the model of generating output in a format that is similar to the input. There are one or two blank spaces before each seat including the first one on each row. The program also describes which seats are being reserved and opened. In an effort to make the changes more visible in this writeup, the seats that have changed status are marked in bold text. Your solution will not use bold output. The donors are listed by seat position starting at row 0 and seat 0. This list would be used to place small gifts before the performance.

The provided code checks for several errors:

You are to check for the following additional errors. Sample messages are listed for each; you will need to follow these formats precisely: When the program encounters one of these "additional" errors, it should exit immediately. You can call exit(0); to do this. (Often you would exit with a non-zero status, but esubmit will report that as an error.) Note that each error message ends with a period. Also note that only one error message is printed for each command when there is a problem. You can add additional checks, but they are not required.

Hints and further requirements

Submission

  1. Ensure the system is fully implemented, including satisfying ALL TODOs. You can leave the TODOs in your code.
  2. Ensure your name is at the top of each source file.
  3. Ensure your code meets the coding standard, especially in documentation and avoiding magic numbers.
  4. Submit tickets.c as main and submit hall.h and hall.c as additional files.

Starter

If your instructor sets it up, you can receive up to 5 bonus points for this assignment by submitting a solution which can read the following data:

        1 someone
        0 END
        3 3
        .  .  .
        -  -  -
        .  .  .
and displaying the concert hall with no donors. A full solution will also work on this, but you do not have to implement the full solution. Submit it to esubmit as mini6.

Test Data