In completing this assignment you MAY use/access the following resources:
- Examples and sample code found here:
https://josephus.hsutx.edu/classes/db/source/
- The SQL handout provided in class and also available here:
https://josephus.hsutx.edu/classes/db/source/sql.pdf
- A text editor (or VSCode) that provides syntax highlighting. You MAY
NOT USE an extensions to such editors/IDEs that produce code.
- The phpPgAdmin front end to your personal database (login is here:
https://csci.hsutx.edu/phpPgAdmin/
- Video instructions provided in Canvas as part of this course. You MAY
NOT USE any other video resources.
- Any handouts provided by the instructor as part of this course.
- Your own course notes
- Your instructor
- Discussions about the assignment with other students as long as you
never look at the code produced by another student and you never receive
instructions about solving the homework. That is, discussions need to
be about concepts and understanding the technologies and not about
how to solve the particular problem posed in this assignment.
You may NOT use/access:
- Resources not expressly listed above, including, but not limited to,
the following ...
- Source code not provided as part of this assignment. (Obviously, this
includes, but is not limited to, source code written by other students
whether current or in the past).
- Code-generating tools (of which ChatGPT is one example).
Failure to abide by these guidelines will result in a zero for the assignment
and the incident will be reported to the university provost as a violation of
the university academic integrity policy. A second incident of academic
dishonesty (whether from this course or another computer science course) will
result in an F in the course.
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:
- Get the next reservation id using nextval.
- Display a list of customer and get the customer id from the user.
- Get a reservation date from the user. (Perhaps use Java
Date object).
- List open rooms for the given date.
- Get list of rooms for reservation from user.
- 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().
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 |