Answered step by step
Verified Expert Solution
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. Book: Attributes: title string: Title of the book. author string: Author of the book. availablecopies int: Number of copies available in the library. totalcopies int: Total number of copies available checked out Funtions: checkout : Decreases the availablecopies by when a book is checked out. checkin : Increases the availablecopies by when a book is returned. Member: Attributes: memberidstring: Unique identifier for a library member. name string: Name of the library member. Functions: borrowbookbook: Checks out a book for the member by calling the checkout method of the book. returnbookbook: Returns a book by calling the checkin method of the book. Library: Attributes: books array of Book: An array to store Book objects. members array of Member: An array to store Member objects. numbooks int: Current number of books in the library. nummembers int: Current number of members in the library. Functions: addbookbook: Adds a book to the library's collection. addmembermember: Adds a member to the library. listbooks : Lists all books with their titles, authors, and availability. listmembers : Lists all members with their names and IDs.
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.
Book:
Attributes:
title string: Title of the book.
author string: Author of the book.
availablecopies int: Number of copies available in the library.
totalcopies int: Total number of copies available checked out
Funtions:
checkout : Decreases the availablecopies by when a book is checked out.
checkin : Increases the availablecopies by when a book is returned.
Member:
Attributes:
memberidstring: Unique identifier for a library member.
name string: Name of the library member.
Functions:
borrowbookbook: Checks out a book for the member by calling the checkout
method of the book.
returnbookbook: Returns a book by calling the checkin method of the book.
Library:
Attributes:
books array of Book: An array to store Book objects.
members array of Member: An array to store Member objects.
numbooks int: Current number of books in the library.
nummembers int: Current number of members in the library.
Functions:
addbookbook: Adds a book to the library's collection.
addmembermember: Adds a member to the library.
listbooks : Lists all books with their titles, authors, and availability.
listmembers : Lists all members with their names and IDs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started