Question: Write a C + + program that that creates a class Book that has the following private attributes: ID ( int ) , title (

Write a C++ program that that creates a class Book that has the following private attributes: ID (int), title (string), price (float) and author (string). The class should contain public functions including all the required getter (e.g., getID) and setter (e.g., se ID) functions. Also, include a displayBookInfo function that displays the book information:
void setID(int id) to set the ID value
void setTitle (string title) to set the title value
void setPrice(float price) to set the price value
void setAuthor(string author) to set the author value
int getID() to get the ID value
string getTitle() to get the title value
float getPrice() to get the price value
string getAuthor() to get the author value
void displayBookInfo () to display the book info as: "The book ID is 122232, title is xxx, price is 39.90, and author is yyy" using the getter functions (e.g., getID).
Then, use the Book class to write a C++ program for an e-book system. Your program should include ways for customers to buy a new book and view their list of purchased books.
Here are the steps:
a. Create an array that can hold 5 books
b. Write a do-while loop that displays a menu to the user:
i. Purchase a new book: if there are less than 5 books, let the user type in the book information.
If there are already 5 books, let the user know and continue the loop
ii. Display all purchased books: display all purchased books
iii. Exit: terminate the loop
Write a C + + program that that creates a class

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 Programming Questions!