Question: Part 1 Publication Class In your solution to homework 3, rename Book to Publication wherever it appears. Test your program to ensure it works properly.

Part 1 Publication Class

In your solution to homework 3, rename Book to Publication wherever it appears. Test your program to ensure it works properly.

Part 2 Book, Music, and Video classes

Add a new Book class, as well as Music and Video classes. All three classes are derived from the Publication class.

Add these member variables:

Book class: pages format (hardcover, softcover, digital)

Music class: duration (seconds) format (MP3, AAV, WAV)

Video class: resolution (low, high, 4K) producer

All three classes should have constructors, get, and set functions.

Extend your main program to edit and display Publication and Person data, using this menu: 1) Display people 2) Display publications 3) Edit people 4) Edit publications 5) Check out publication 6) Check in publication 7) Quit

here is the other code:

#ifndef PERSON_H #define PERSON_H #include using namespace std;

class Person { string fullName; int identifier; string email; public: Person() { fullName = ""; identifier = 0; email = ""; } Person(string name, int id, string mail) { fullName = name; identifier = id; email = mail; } void setFullName(string name) { fullName = name; } void setIdentifier(int id) { identifier = id; } void setEmail(string mail) { email = mail; } string getFullName() { return fullName; } int getIdentifier() { return identifier; } string getEmail() { return email; } }; #endif

#ifndef BOOK_H #define BOOK_H class Book { string title; string author; bool status; //To check if book is checked out. Person borrower; //Person who borrowed the book. public: Book(string ttl, string athr, bool stts, Person brwr) { title = ttl; author = athr; status = stts; borrower = brwr; } /*Person getBorrower() { return borrower; }*/ void setBorrower(Person brwr) { borrower = brwr; } void checkOut(Person brwr) { if(!status) setBorrower(brwr); } void checkIn() { status = false; } string getTitle() { return title; } string getAuthor() { return author; } bool getStatus() { return status; } string getBorrower() { string temp = "Name : " + borrower.getFullName(); temp += " ID : " + to_string(borrower.getIdentifier()); temp += " Email: " + borrower.getEmail(); return temp; } }; #endif

#include

using namespace std; int main() { Person person1 ("Ito Duy Le", 123, "Leduyhoangminh95@hotmail.com"); Person person2 ("Daniel Hien Dang", 234, "danielhiendang95@gmal.com"); Person person3("Jen Nguyen", 345, "Jennguyen95@gmal.com"); Person person4("Laxus Dreyar", 456, "Laxusdreyar23@yahoo.co.in"); cout << "Name : " << person1.getFullName() << endl; cout << "ID : " << person1.getIdentifier() << endl; cout << "Email: " << person1.getEmail() << endl << endl; cout << "Name : " << person2.getFullName() << endl; cout << "ID : " << person2.getIdentifier() << endl; cout << "Email: " << person2.getEmail() << endl << endl; cout << "Name : " << person3.getFullName() << endl; cout << "ID : " << person3.getIdentifier() << endl; cout << "Email: " << person3.getEmail() << endl << endl; cout << "Name : " << person4.getFullName() << endl; cout << "ID : " << person4.getIdentifier() << endl; cout << "Email: " << person4.getEmail() << endl << endl; person1.setFullName("Laxus Dreyar"); person1.setIdentifier(567); person1.setEmail("Laxusdreyar23@yahoo.co.in") cout << "Name : " << person1.getFullName() << endl; cout << "ID : " << person1.getIdentifier() << endl; cout << "Email: " << person1.getEmail() << endl << endl; Book book1("Programming in C", "Dennis Ritchie", true, person1); cout << "Title: " << book1.getTitle() << endl; cout << "Author: " << book1.getAuthor() << endl; if(book1.getStatus()) cout << "Borrower Details: "<< endl << book1.getBorrower() << endl << endl; Book book2("Macbeth", "William Shakespear", false, person1); cout << "Title: " << book2.getTitle() << endl; cout << "Author: " << book2.getAuthor() << endl; if(book2.getStatus()) cout << "Borrower Details: "<< endl << book2.getBorrower() << endl << endl; Book book3("First Love", "Sachin Garg", true, person2); cout << endl << "Title: " << book3.getTitle() << endl; cout << "Author: " << book3.getAuthor() << endl; if(book3.getStatus()) cout << "Borrower Details: "<< endl << book3.getBorrower() << endl; }

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!