Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ A) (15 pts) class Book with the following members: 1. private members: a. book title (string) b. book ISBN (string) c. book first author

C++

image text in transcribed

A) (15 pts) class Book with the following members: 1. private members: a. book title (string) b. book ISBN (string) c. book first author (string) d. book number_of_copies (int) Note: for this assignment, a book ISBN can be any string (such as 978-3-16) and it should be unique for each book. 2. public members: a. A parameterized constructor with default arguments for all data members: -' for the string data members and o for the numeric data member. The constructor should initialize all data members properly b. setters and getters for all data members. The setter for the number of copies should validate that the number is greater than or equal to zero. and for strings to be non- empty. C. The member function updateBookNumCopies(int n) to update the number of copies of a book. The function receives an integer value (can be negative or positive) and updates the current number of copies only If the result of adding that value to the current count is zero or more, otherwise, it prints a proper error message. B) (40 pts) class Library where a library contains several books that can be added or removed. Implement class Library with the following: 1. Three private data members: a. int maxSize that represents the maximum number of books (i.e., unique book titles) that can be added to the library. Note that you can add any number of copies of a given book. b. int current that tracks the current number of unique book titles in the library. this attribute gets updated whenever a new book-title is removed or added to the library. c. Book *bookList, a pointer to a dynamic array of Books that represent all unique book titles in the library. 2. The private member function void resize Library(int n), which resizes the dynamic array pointed to by the pointer bookList. a. The function should increase the array capacity by the amount of n. b. The function should validate that n is a positive integer. C. The function must preserve the data that was already in the list. 3. The following public member functions: Use this pointer in all member functions of the class that take one or more parameters. a. Library(int n): that sets maxSize to n, allocates dynamic space of size maxSize, and makes the bookList pointer points to the allocated space, and sets current to 0. b. A copy constructor Library(const Library &) to properly copy data from one Library object to another. C. -Library0: Deallocates any dynamically allocated memory for an object. d. isEmpty(), a boolean function that returns true if the library is empty. and false otherwise. e. isFull), a boolean function that returns true if the library is full, and false otherwise

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago