Question: Do this in C++ //bookType.h #ifndef NEW_BOOKTYPE_H #define NEW_BOOKTYPE_H #include using namespace std; //class definition of bookType class bookType { public: bookType(); void setTitle(string); string

Do this in C++

Do this in C++ //bookType.h #ifndef NEW_BOOKTYPE_H #define NEW_BOOKTYPE_H #include using namespace

//bookType.h

#ifndef NEW_BOOKTYPE_H #define NEW_BOOKTYPE_H

#include

using namespace std;

//class definition of bookType class bookType { public: bookType(); void setTitle(string); string getTitle(); bool compareTitle(string);

void setAuthor(string = ""); void showAuthors(); void updateAuthor(string = ""); string * getAuthors();

void setCopies(int); void showCopies(); void updateCopies(int); int getCopies();

void setPublisher(string); void showPublisher(); void updatePublisher(string); string getPublisher();

void setISBN(string); void showISBN(); void updateISBN(string); string getISBN(); bool compareISBN(string);

void setPrice(double); void showPrice(); void updatePrice(double); double getPrice();

bookType(const bookType & ); ~bookType(); void operator = (const bookType & );

private: string title; string * authors; string publisher; string ISBN; double price; int copies; int authorsNo; };

#endif

**********************************************************************************************************************

//bookType.cpp

#include "bookType.h"

#include

using namespace std;

//This sets the constructor as bookType bookType::bookType() { title = ""; authors = new string[4]; for (int i = 0; i

//Method definition of setTitle, getTitle, and compareTitle void bookType::setTitle(string myTitle) { title = myTitle; }

string bookType::getTitle() { return title; }

bool bookType::compareTitle(string otherTitle) { return (title.compare(otherTitle) == 0); }

//Method definition of setAuthor, showAuthors, updateAuthors, and getAuthors void bookType::setAuthor(string myAuthor) { authorsNo = authorsNo % 4; if (myAuthor.compare("") == 0) return; else { authors[authorsNo] = myAuthor;

authorsNo++; } }

void bookType::showAuthors() { for (int i = 0; i

void bookType::updateAuthor(string myAuthor) { setAuthor(myAuthor); }

string * bookType::getAuthors() { return authors; }

//Method definition of setCopies, showCopies, showCopies, and getCopies void bookType::setCopies(int myCopies) { copies = myCopies; }

void bookType::showCopies() { cout

void bookType::updateCopies(int myCopies) { copies = myCopies; }

int bookType::getCopies() { return copies; }

//Method definition of setPublisher, showPublisher, updatePublisher, and getPublisher void bookType::setPublisher(string myPublisher) { publisher = myPublisher; }

void bookType::showPublisher() { cout

void bookType::updatePublisher(string myPublisher) { publisher = myPublisher; }

string bookType::getPublisher() { return publisher; }

//Method definition of showISBN, updateISBN, getISBN, and compareISBN void bookType::setISBN(string myISBN) { ISBN = myISBN; }

void bookType::showISBN() { cout

void bookType::updateISBN(string myISBN) { ISBN = myISBN; }

string bookType::getISBN() { return ISBN; }

bool bookType::compareISBN(string myISBN) { return (myISBN.compare(ISBN) == 0); }

//Method definition of setPrice, showPrice, updatePrice, and getPrice void bookType::setPrice(double myPrice) { price = myPrice; }

void bookType::showPrice() { cout

void bookType::updatePrice(double myPrice) { price = myPrice; } double bookType::getPrice() { return price; }

bookType::bookType(const bookType & source) { title = source.title; authors = new string[4]; for (int i { 0 }; i

bookType::~bookType() { delete[] authors; }

void bookType::operator = (const bookType & source) { title = source.title; authors = new string[4]; for (int i { 0 }; i

**********************************************************************************************************************

//main.cpp

#include

#include "bookType.h"

using namespace std;

//Main function int main() { //Prompts the opening message cout

//Declares an array of 100 bookType numBooks[100];

//variables string str; double price; int copies; char userChoice; int count = 0;

do { //Prompts the input from the user cout > str; numBooks[count].setTitle(str); int x = 0; do { cout > str; numBooks[count].setAuthor(str); x++; cout > userChoice; }

while (x > str; numBooks[count].setPublisher(str); cout > str; numBooks[count].setISBN(str); cout > price; numBooks[count].setPrice(price);

// Prompts the number of copies cout > copies; numBooks[count].setCopies(copies); count++; cout > userChoice;

if (userChoice

} while (userChoice != 'n');

do { //searches for a book using title and ISBN cout > userChoice; int i; char T, I, U, E; switch (toupper(userChoice)) {

case 'T': cout > str;

for (i = 0; i

if (i == count) cout

case 'I': cout > str;

for (i = 0; i

if (i == count) cout

break;

// Updates the amount of copies of the book case 'U': cout > str;

for (i = 0; i

if (i == count) cout > copies; numBooks[i].updateCopies(copies); } break;

case 'E': return 0; } } while (true); return 0; }

1. Modify your bookType ADT that you created in Module 3 Project A. In this project you will update the implementation of your ADT by: Adding a copy constructor Overloading the assignment operator 2. Be sure to avoid multiple inclusion of your header file (.h file) by adding the appropriate preprocessor commands in the header file itself. Example: #ifndef H_test #define H_test // Your interface file code goes here #endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!