For this assignment, you will be writing a C/C++ program that prints reports on the books found in the henrybooks database from our MariaDB server.
Requirements
Your program will show a menu with three options for reports to show. The user will choose an option, and your program will use the MariaDB C API to run the necessary queries, displaying the results, neatly formatted, in the terminal.
- BookList: For each book, print the title, the author(s), and the cost. Do not assume that a book will be written by a single author. Use a subquery to accomplish this. Sort the authors for each book based on their Sequence.
- Author Search: Prompt the user for the name of an Author. Print a report showing all books by authors whose first or last names match the user-supplied name. For each of the books found, show a line in your output with the book code, the title, the name of the author that matched your search, and the price; then show individual lines (indented below the original line) for each branch, each showing how many of the current book are on hand, or a single line indicating that it is out of stock everywhere if no branches have any on hand. Branches should be displayed as their names and not as their numerical identifiers, in alphabetical order.
- TitleSearch: Same as the author search in feature 2, but search by title instead of by author. For the author field, use the first author only (by sequence number).
There should also be an option to quit. After performing whichever option is chosen (obviously except for the one to quit), your program should show the menu again and allow the user to choose a new option to run.
Notes
- The grading for this will be done by compiling and running this program on turing and/or hopper. If your program does not compile and run properly on turing and hopper, you will not receive credit, so make sure to test it there.
- If your program needs any flags other than the ones used in the examples of gcc/g++ in the slides in order to compile, you need to let us know when you submit.
- Don’t forget to document your code.
- It is not a requirement that every feature be implemented with a single query. You can break the tasks down into smaller queries if you find it makes solving the problem easier.
- As always, you should be submitting your own work. Do not try to cheat or plagiarize other people’s programs.
Reviews
There are no reviews yet.