Discover answers to your most pressing questions at Westonci.ca, the ultimate Q&A platform that connects you with expert solutions. Join our Q&A platform to connect with experts dedicated to providing precise answers to your questions in different areas. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.

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 char array with room for 10 characters plus the null character, i.e. 11 elements total)
A title (a char array with room for 40 characters plus the null character)
A price (a double variable)
A quantity in stock (an integer variable)

Note: Make that sure you code your data members in THE EXACT ORDER LISTED ABOVE and with THE EXACT SAME DATA TYPES. If you use float instead of double or only make the title array 40 characters long instead of 41, your program will not work correctly.

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.

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 book store is actually able to ship at this time.

The logic for this function should be as follows:
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.
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.
Otherwise, this order can not 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.

Sagot :