Question: The Book class has a default constructor with no parameters. Define an overloaded constructor that takes two string parameters and initializes the book's title and

The Book class has a default constructor with no parameters. Define an overloaded constructor that takes two string parameters and initializes the book's title and author with the strings.

Ex: If the input is Painting West, then the output is:

Book: Unknown, NoName Book: Painting, West

#include #include using namespace std;

class Book { public: Book(); Book(string bookTitle, string bookAuthor); void Print(); private: string title; string author; };

Book::Book() { title = "Unknown"; author = "NoName"; }

/* Your code goes here */

void Book::Print() { cout << "Book: " << title << ", " << author << endl; }

int main() { string bookTitle; string bookAuthor; cin >> bookTitle; cin >> bookAuthor; Book emptyBook; Book book1(bookTitle, bookAuthor); emptyBook.Print(); book1.Print();

return 0; }

c++ and please please make it correct

whats blurr about it, its written out

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!