Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will write a program that uses a class bookType, which will hold specific in

ID: 3839266 • Letter: Y

Question

You will write a program that uses a class bookType, which will hold specific information about a book, and various functions to be performed on a book. You will define an array to hold 5 books and read in the information about the books from a data file called bookInfo.txt. The program will then ask the user to search for a book based on some of the info (Tile or Author or ...) and display the information about the book if it is in the list. A bookType will store the following information about a book: a. Title b. Author c. ISBN d. Price e. Number of copies in stock The operations that should be performed on a bookType are: a. Show the different pieces of information (i.e. Title, author, etc.) b. Set the different pieces of information c. Check if a title is an actual title of a book, author is an actual author, etc. The class must have a default constructor that sets the member variables to a default value The class definition MUST be in a file called bookType.h, and the class function definitions must be in a file called bookTypeimp.cpp.

Explanation / Answer

class Book{

public:
   Book();
   void setTitle(string title);
   void setAuthor(string author);
   void setISBN(string isbn);
   void setPrice(double price);
   void setNumberOfCopies(int numberOfCopies);

   bool isTitle(string title);
   bool isAuthor(string author);
   bool isISBN(string isbn);
   bool isPrice(double price);
   bool isNumberOfCopies(int numberOfCopies);

private:
   string title;
   string author;
   string isbn
   double price
   float numberOfCopies
};


Book::Book() {
   title = "";
   author = "";
   isbn = "";
   price = 0;
   numberOfCopies = 0;
}

void Book::setTitle(string title) {
   this->title = title;
}

void Book::setAuthor(string author) {
   this->author = author;
}

void Book::setISBN(string isbn) {
   this->isbn = isbn
}

void Book::setPrice(double price) {
   this->price = price
}

void Book::setNumberOfCopies(int numberOfCopies) {
   this->numberOfCopy = numberOfCopy;
}

void Book::show() {
   cout << "Title: " << title << endl;
   cout << "Author: " << author << endl;
   cout << "ISBN: " << isbn << endl;
   cout << "Price: " << price << endl;
   cout << "Copies : " << numberOfCopies << endl;
}

bool Book::isTitle(string title) {
   return (title.compare(this->title)) == 0
}

bool Book::isAuthor(string author) {
   return (author.compare(this->author)) == 0
}
bool Book::isISBN(string ISBN) {
   return (isbn.compare(this->isbn)) == 0
}
bool Book::isPrice(double price) {
   return price == this->price;
}
bool Book::isNumberOfCopies(int numberOfCopies) {
   return numberOfCopies == this->numberOfCopies;
}

So here you go champ. you have the header and the body of the function. Hope you like it. If you neeed any more help, please let me know. I shall try my best to relsolve all your issues

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote