Question
Requirements: 1. Create BookClass.h with the following: Member variables: title. A string that holds the books title author. A string that holds the books author
Requirements:
1. Create BookClass.h with the following:
Member variables:
title. A string that holds the books title
author. A string that holds the books author
publisher. A string that holds the books publisher
isbn. A string that holds the books ISBN number
price. A double that holds the books price
year. An int that holds the year when the book was published
numInStock. An int that holds the number of copies of this book
Member functions
void storeBook(string bookTitle, string authorName, string bookPublisher, string bookISBN, double bookPrice, int bookYear, int booksInStock)
o Stores the parameters into the BookClass member variables
void displayBookInfo() Displays the contents of the BookClass member variables
void checkOutBook() Subtracts 1 from the numInStock member variable; tests to make sure numInStock is not 0
void returnBook() Adds 1 to the numInStock member variable
string getTitle() Returns the value in title
int getNumInStock() Returns the value in numInStock
2. Create BookMain.cpp to test your BookClass.
Functions:
void getBookInfo (BookClass &);
o Asks the user to enter information for one book, then invokes member function storeBook to store the information in the BookClass variable.
Test your class and function with a main program:
Call getBookInfo to store the book information into the BookClass variable
Call CheckOutBook
Call getTitle to get the books title
Call getNumInStock to get the number of copies currently in stock
Display the books title and number of copies in stock
Call returnBook
Call getTitle to get the books title
Call getNumInStock to get the number of copies currently in stock
Display the books title and number of copies in stock
3. HINT: You need to use getline to input string data that contains spaces.
4. IMPORTANT: When using getline following the use of cin with numeric input, you need to use cin.ignore() to skip over the end of line character or you will get into an infinite loop.
5. Output must be labelled and easy to read
6. Program must be documented with Name, Date, Program Name, and description
7. Submit zipped file with project, .cpp and screenshots of program oujtput
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started