Question
Code in C++ Proof: a. Some of the characteristics of a book are the title, author(s), publisher, ISBN, price, and year of publication. Design a
Code in C++
Proof:
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 showthe 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.
Need:
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.
My code (in C++) so far:
#include
using namespace std; class booktype { public: string title,authors[4],publisher,isbn; double price; int year_pub,num_authors,num_stock; public: booktype(string t,string author,string publisher); void showtitle(); void readauthors(int n); void setprice(double p); void showprice(); void shownum_stock(); void setnumstock(int n); }; booktype::booktype(string t,string isbn,string publisher) { title=t; this->isbn=isbn; this->publisher=publisher; } void booktype::showtitle() { cout<< "title"<
void booktype::setprice(double p) { price=p; } void booktype::showprice() { cout<<"price"<
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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