Learning Outcomes to be assessed
This is an individual coursework and no part of this coursework is to be attempted as a group or with the aid of third parties. This coursework requires you to develop one computer program using the Python v3 language that is both:
1. User Interactive Program, and a
2. Data Processing Program Learning Outcome to be assessed
1. Demonstrate knowledge of programming constructs and basic algorithms
2. Demonstrate problem solving skills by producing simple programming solutions.
3. Evaluate alternatives and make sound judgements regarding programming solutions.
A file called ‘reservation.dat’ accompanies this specification on Canvas and contains the data structure for all of the seats with none of them reserved.
Task A: Internal Documentation
Your algorithm design pseudocode should be appropriately implemented as comments throughout your program. Where there is a selection (if, if-else, elif) or repetition (for, while) construct used, you must include in its associated comment, a justification as to why you chose that particular construct type over the others available. If you develop your own user defined functions, they should each have a comment header describing the basic idea of what the function is for as well as listing and describing any input parameters and any return value.
Task B: Reading in the file
The program should check that the reservation file, called ‘reservation.dat’ exists in the same directory as the program. If it does not the program should output an appropriate error message and then end. If it does exist, json.load() should be used to load in the data into a python variable.
Task C: Interactive Menu System
The program should implement a command-line repeating interactive menu with the following options:
1. Display Seat Reservations
2. Reserve a seat
The menu system should repeat until the user chooses to quit and confirms they want to quit; i.e. once the user chooses the quit option, the program should ask, ‘Are you sure (y/n)’. Only if the user enters ‘Y’, or ‘y’ should the program save the reservation file (Task F below) and then end, otherwise the user should be returned to a newly displayed menu.
Task E: Seat Reservation
The seat reservation option should be implemented in the form of a sequential question and answer wizard, as follows:
Enter the seat number you wish to reserve:
If the seat is already reserved, then the program should provide an error message and then return to the menu. Otherwise, it should then output: The Forwards/Backwards nature of the seat and which table (if any) it is at.
It should ask if they wish to proceed in the reservation (Y/N) and if they do should ask for:
The name of person seat is being reserved for
The phone number of person reserving the seat
The program should then update the loaded in data structure.
Task F: File Output
You should ensure the file is ‘closed’ before re-opening it in ‘write’ mode, which will overwrite the file. While you are developing this code, you should keep a backup copy of the data file so you can reset it if your code corrupts it. You should then use ‘json.dump()’ to write the data structure out to the file before closing it.