Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C + + program that demonstrates the use of following classes to implement Library management system. Create instances of books and members, add

Write a C++ program that demonstrates the use of following classes to implement Library management system. Create instances of books and members, add them to a Library object,
and perform different tasks. Display the list of books and members after each operation.
1. Book:
Attributes:
title (string): Title of the book.
author (string): Author of the book.
available_copies (int): Number of copies available in the library.
total_copies (int): Total number of copies (available + checked out).
Funtions:
check_out() : Decreases the available_copies by 1 when a book is checked out.
check_in() : Increases the available_copies by 1 when a book is returned.
2. Member:
Attributes:
member_id(string): Unique identifier for a library member.
name (string): Name of the library member.
Functions:
borrow_book(book): Checks out a book for the member by calling the check_out()
method of the book.
return_book(book): Returns a book by calling the check_in() method of the book.
3. Library:
Attributes:
books (array of Book): An array to store Book objects.
members (array of Member): An array to store Member objects.
num_books (int): Current number of books in the library.
num_members (int): Current number of members in the library.
Functions:
add_book(book): Adds a book to the library's collection.
add_member(member): Adds a member to the library.
list_books (): Lists all books with their titles, authors, and availability.
list_members (): Lists all members with their names and IDs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

If A E M, has only real eigenvalues, show that A is similar to A*.

Answered: 1 week ago

Question

a. Did you express your anger verbally? Physically?

Answered: 1 week ago