Question: Question 3 [ 3 0 marks ] You are the head librarian at a local library. Your current system for managing books is outdated and

Question 3[30 marks]
You are the head librarian at a local library. Your current system for managing books
is outdated and inefficient. You decide to create a program to streamline book
management tasks like adding new arrivals, searching for specific titles, and keeping
track of the library's collection.
Required
Build a library management system using functions, arrays, a Book class, and PDO
for MySQL interaction.
Instructions:
In your program, create a book class with methods and functions to add, display, and
search for books in a database. Implement PDO for CRUD operations and a menudriven interface.
1. Create a Book class with properties like title, author, ISBN, and genre.
2. Implement methods in the Book class to:
a. Set book information.
b. Display book information.
3. Develop functions for:
a. Adding a new book to the database (addBook): This function should take
a Book object as input and insert its information into the books table in the
database.
b. Displaying a list of all books (displayBooks): This function should retrieve
book data from the database and display it in a user-friendly format (e.g.,
table).
c. Searching for a book by title (searchBook): This function should allow the
user to enter a book title (or part of it) and search the database for matching
books.
4. Utilise PDO to connect to a MySQL database and perform CRUD (Create, Read,
Update, Delete) operations on the books table. (Note: you should only have
Create and Read functionalities)
8 HSYD300-1- Jul-Dec2024-FA1-RM-V4-27082024
5. Implement error handling for database connections and queries using try-catch
blocks.
Rubric
Criteria Possible Mark
Book Class 5
Functions: addBook, displayBooks and searchBook 15
Database schema and PDO to connect to a MySQL
database 5
Error handling for database connections and queries
using try-catch blocks. 5
Mark
Question 3 [ 3 0 marks ] You are the head

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!