a. Some of the characteristics of a book are the title, author(s), publisher, IS
ID: 3559459 • Letter: A
Question
a. Some of the characteristics of a book are the title, author(s), publisher,
ISBN, price, and year of publication. Design a class bookType that
defines the book as an ADT.
i. Each object of the class bookType can hold the following
information about a book: title, up to four authors, publisher,
ISBN, price, and number of copies in stock. To keep track of
the number of authors, add another member variable.
ii. Include the member functions to perform the various operations on
objects of type bookType. For example, the usual operations that
can be performed on the title are to show the title, set the title, and
check whether a title is the same as the actual title of the book.
Similarly, the typical operations that can be performed on the
number of copies in stock are to show the number of copies in stock,
set the number of copies in stock, update the number of copies in
stock, and return the number of copies in stock. Add similar operations
for the publisher, ISBN, book price, and authors. Add the
appropriate constructors and a destructor (if one is needed).
b. Write the definitions of the member functions of the class bookType.
c. Write a program that uses the class bookType and tests various
operations on the objects of the class bookType. Declare an array
of 100 components of type bookType. Some of the operations that you
should perform are to search for a book by its title, search by ISBN, and
update the number of copies of a book.
How do i extend this question to meet this:
Extend the bookType class to have a subclass called textBookType. Additional information that textBookType will hold is the subject area, the number of chapters, and the number of pages. Include appropriate member functions to go with each of the new properties. Update the main application file and your text file to have the array be able to handle both types of books. You only need new files for textBookType.h, textBookType.cpp (header and implementation). The main application file will be the same file.
I already have the first part down it is just the above extension that is giving me issues.
Explanation / Answer
#include #include using namespace std; class BookType{ private: string Title; string Authors[4]; string publisher; int ISBN; double price; int NumOfCopies; int AotherMember; public: void setTitle(string t); string getTitle(); void showTitle(); void setAuthors(string A[4]); string getAuthors(); void showAuthors(); void setpublisher(string p); string getpublisher(); void showpublisher(); void setISBN(int I); int getISBN(); void showISBN(); void setprice(double r); double getprice(); void showprice(); void setNumOfCopies(int N); int getNumOfCopies(); void showNumOfCopies(); void setAotherMember( int M); int getAotherMember(); void showAotherMember(); BookType(string t="",string A[4]=("","","",""),string p="",int I=0, double r=0, int N=0, int M=0); ~BookType(); }; void BookType::setTitle(string t){ Title=t; } string BookType::getTitle(){ return Title; } void BookType::showTitle(){ coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.