HW09: Java Front End due Wed 22 Mar 13:00

This assignment makes use of previously written code as the bas...
...rvation database. It also
provides practice in JDBC programming.


In this assignment you will create a (somewhat limited) Java text-based interface to your Postgres hotel reservations database. In particular you will allow creation of a reservation (including assignment of rooms), canceling a reservation, and displaying some helpful queries.

Follow these steps as you complete this assignment:

Create a main menu
that will include the following options:
  • Make a Reservation
  • Cancel a Reservation
  • List Current/Upcoming Reservations
  • Display Revenue for Current Month
  • Exit Program

The menu should be displayed when the program is run and should be placed in a loop to repeat until the user chooses to exit the program.

Make a Reservation
To make a reservation you'll need to:
  1. Get the next reservation id using nextval.
  2. Display a list of customer and get the customer id from the user.
  3. Get a reservation date from the user. (Perhaps use Java Date object).
  4. List open rooms for the given date.
  5. Get list of rooms for reservation from user.
  6. Insert entries into reservation table and room_reservation table.

NOTE: To view customers and open rooms you can/should use the displayQuery() method you wrote in the previous assignment.

NOTE: Be aware a SQL injection concerns.

Cancel a Reservation
List existing reservations and have user select a reservation id. Then delete the appropriate reservation. NOTE: What happens to entries in room_reservation when they cancel?

List Current/Upcoming Reservations
The list should contain reservations from the current day and on into the future. (Do not show reservations in the past). Once you build a proper query this become a simple call to displayQuery().

Display Revenue for Current Month
This query should group revenue for the month by room number so we can see which rooms are generating the most revenue. This is another call to displayQuery().

Grading and Submission

To turn in the assignment combine your source code file into a ZIP archive and upload it into Canvas. Your assignment will be graded as follows:

Make Reservation 12 pts
Cancel Reservation 3 pts
List Reservations 5 pts
Display Revenue 4 pts
Menu, etc. 2 pts
Total 26 pts