Question: You will write four files for this assignment: book.h , book.cpp , book _ store.h , and book _ store.cpp . All four of these

You will write four files for this assignment: book.h, book.cpp, book_store.h, and book_store.cpp. All four of these files will need to be submitted to the Grade-o-Matic. 4.1. book.h This header file will contain the class definition for a class called book. The book class represents inventory information about a single book title. The header file should include an appropriate set of header guards to prevent it from being included more than once in the same source file. Data Members The book class should have the following private data members: An ISBN (a string) A title (a string) A price (a floating-point variable) A quantity in stock (an integer variable) Member Functions The book class definition should contain public prototypes for all of the member functions list in the book.cpp description below. 4.2. book.cpp This source code file will contain the member function definitions for the book class. The required member functions are described below: Default constructor The default constructor should set the ISBN and title data members to the string literal "None". The price and quantity in stock data members should be set to 0. Alternate constructor The alternate constructor should take four parameters: a reference to a constant string (the ISBN of the book), another reference to a constant string (the title of the book), a floatingpoint number (the price of the book), and an integer (the quantity of the book in stock). The data members of the object should be initialized to these parameters. get_isbn() This accessor member function has no parameters. It should return the ISBN. get_price() This accessor member function has no parameters. It should return the price. fulfill_order()- This member function takes one parameter, an integer that represents the quantity of this book that has been ordered. The function returns an integer, which is the quantity of this book that the bookstore is actually able to ship at this time. The logic for this function should be as follows: o If the order quantity is less than zero, the order is in error. The number shipped should be zero. Do not alter the quantity in stock for the book. o If the order quantity is less than or equal to the quantity in stock, the order can be completely filled. The number shipped should be the same as the order quantity, and the order quantity should be subtracted from the quantity in stock. o Otherwise, this order cannot be completely filled. The number shipped should be the quantity in stock, and the quantity in stock should be set to zero. print()- This member function takes no parameters and returns nothing. The method should print the ISBN, title, price, and quantity members on the console using cout. Use setw() to line the printed values up in columns (a width of 14 for the ISBN, 44 for the title, 5 for the price, and 6 for the quantity will match the sample output). The ISBN and title should be left justified; the price and quantity should be right justified. The price should be printed using fixed-point notation with two places after the decimal point. 4.3. book_store.h This header file will contain the class definition for a class called book_store. The book_store class represents information about a collection of books. The header file should include an appropriate set of header guards to prevent it from being included more than once in the same source file. Data Members The book_store class should have the following two private data members: An array of 30 book objects. An integer that represents the number of elements of the book array that contain valid data. Member Functions The book_store class definition should contain public prototypes for all of the member functions in the book_store.cpp source code file described below. 4.4. book_store.cpp This source code file will contain the member function definitions for the book_store class. The required member functions are described below: Default constructor The default constructor should set the number of books data member to 0. No initialization is necessary for the array of book objects, since the book default constructor will automatically be called for every object in the array. read_books() This member function takes one parameter, a string that contains the name of a file. This string parameter can be a C++ string or a C string (your choice). The function returns nothing. This constructor should do the following: 1. Declare and open an input file stream variable using the file name string passed in as a parameter. 2. Check to make sure the file was opened successfully. If not, print an error message and exit the program. 3. Read the ISBN of the first record into a local variable using the std::getline() function with a colon as the delimiter. 4.Loop while the file stream variable is not at end of file. 5. Read each of the remaining fields of the record into local variab

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!