Starting from:

$25

CSCI466Assignment10 - Solved




MariaDBinC++(100pts)

TheTask
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.

1.    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.

2.    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.

3.    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.



 

Schemaforhenrybooks

For your convenience, I have included information on the schema of henrybooks below:

Table
Field
Type
Null
Key
Default
Extra
Author
AuthorNum
decimal(2,0)
NO
PRI
NULL
 
 
AuthorLast
char(12)
YES
 
NULL
 
 
AuthorFirst
char(10)
YES
 
NULL
 
Book
BookCode
char(4)
NO
PRI
NULL
 
 
Title
char(40)
YES
 
NULL
 
 
PublisherCode
char(3)
YES
 
NULL
 
 
Type
char(3)
YES
 
NULL
 
 
Price
decimal(8,2)
YES
 
NULL
 
 
Paperback
char(1)
YES
 
NULL
 
Branch
BranchNum
decimal(2,0)
NO
PRI
NULL
 
 
BranchName
char(50)
YES
 
NULL
 
 
BranchLocation char(50)
YES
 
NULL
 
 
NumEmployees
decimal(2,0)
YES
 
NULL
 
Inventory BookCode
char(4)
NO
PRI
 
 
BranchNum
decimal(2,0)
NO
PRI
0
 
OnHand
decimal(2,0)
YES
 
NULL
 
Publisher PublisherCode
char(3)
NO
PRI
NULL
 
PublisherName
char(25)
YES
 
NULL
 
City
char(20)
YES
 
NULL
 
Wrote      BookCode
char(4)
NO
PRI
 
 
AuthorNum
decimal(2,0)
NO
PRI
0
 
Sequence
decimal(2,0)
YES
 
NULL
 
 

More products