Question
C++ code: I'm not sure how to implement these changes. #include selectionSort.h int cashier() { string date; string ISBN; string Title; int numOfBook; double price;
C++ code: I'm not sure how to implement these changes.
#include "selectionSort.h"
int cashier() { string date;
string ISBN;
string Title;
int numOfBook;
double price;
double subtotal;
double tax;
double total;
bool finished = false;
char choice = '\0';
do { cout
cout
cout
cout
cout
cin.ignore(25,' ');
getline(cin, date);
cout
cin >> numOfBook;
cin.ignore(25,' ');
cout
getline(cin, ISBN);
cout
getline(cin, Title);
cout
cin >> price;
cin.ignore(25,' ');
subtotal = numOfBook * price;
tax = 6 * subtotal / 100;
total = subtotal + tax;
//OUTPUT
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cin >> choice;
if(choice != 'Y' || choice != 'y') { finished = true; }
cout
cout
return 0;
}
LOOKUP BOOK
#include "selectionSort.h"
int lookUpBook(BookData myBooks[], const int DBSIZE, int bookCount) {
char choice;
string searchTitle;
cout >> BOOK LOOK UP
cout
getline(cin,searchTitle);
//for loop to search for desired book for(int i = 0; i
cout
cin >> choice;
cin.ignore (100, ' ');
/ested if to check for choice case if(choice == 'Y' || choice == 'y') {
return i;
}//end if
}//end if
}//end for loop
cout
system("pause");
return -1; } HEADER FILE
#ifndef SELECTIONSORT_H_ #define SELECTIONSORT_H_
#include #include #include #include
using namespace std;
//Struct for arrays struct BookData { string bookTitle; string isbn; string author; string publisher; string dateAdded; int qtyOnHand; double wholesale; double retail; };
//bookInfo Function void bookInfo(string bookTitle, string isbn, string author, string publisher, string dateAdded, int qtyOnHand, double wholesale, double retail);
//cashier Function int cashier();
//reports Function int reports();
//invMenu Function void invMenu(BookData myBooks[], const int DBSIZE, int& bookCount);
//Inventory Stub Functions int lookUpBook( BookData myBooks[], const int DBSIZE, int bookCount);
void addBook( BookData myBooks[], const int DBSIZE, int& bookCount);
void editBook( BookData myBooks[], const int DBSIZE, int bookCount);
void deleteBook(BookData myBooks[], const int DBSIZE, int& bookCount);
//Reports Stub Functions void repListing(); void repWholesale(); void repRetail(); void repQty(); void repCost(); void repAge();
//set functions: void setTitle (BookData myBooks[], string *pTitle, int n); void setISBN (BookData myBooks[], string *pISBN, int n); void setAuthor (BookData myBooks[], string *pAuthor, int n); void setPub (BookData myBooks[], string *pPub, int n); void setDateAdded(BookData myBooks[], string *pDateAdded, int n); void setQty (BookData myBooks[], int *pQty, int n); void setWholesale(BookData myBooks[], double *pWholesale, int n); void setRetail (BookData myBooks[], double *pRetail, int n);
#endif /* SELECTIONSORT_H_ */
For this chapter's assignment (Ch 10) you will be adding single purchase functionality (only 1 book purchase per receipt) to the cashier module and convert your data structure to an array of classes. If multiple purchases of the same book are requested by the user, only show one instance of the book (with combined quantities) on the receipt (i.e.): Purchase Request: 2 x Star Wars Do you want to add another book to this purchase? (y) Y Purchase Request: 1 x Hobbit Do you want to add another book to this purchase? (y) Y Purchase Request: 3 x Star Wars Do you want to add another book to this purchase? (y) N **** RECEIPT *** Star Wars x 5 Hobbit x 1 ... Grand total .... Confirm Purchase? (y) Y subtract quantities from the actual book records in your array of classes. You must adhere to the UML provided below. I have recently updated the UML to convert bookCount into a static variable (private) that belongs to the bookType class along with a static getter and inc/dec methods. bookCount is only incremented/decremented via the increment and decrement static methods. serendipity(ch10) UML-1.pptx Sample Grading Metric 1. Show bookType.cpp and bookType.h (must adhere to standard) a. constructors b. setters/getters c. print (aka bookInfo) d. equals e. static data/function members 2. Show array of bookTypes declaration. 3. Fill array (copy/paste) with the 20 books. a. Try to add 21st book (should not allow) b. Delete Dark Force Rises book C. Add Tainted Sword 4. Purchase Request: 2 x Star Wars Do you want to add another book to this purchase? (y) Y Purchase Request: 1 x Hobbit Do you want to add another book to this purchase? (y) Y Purchase Request: 3 x Star Wars Do you want to add another book to this purchase? (y) N RECEIPT *** Star Wars x 5 (You get the idea) Hobbit x 1 Grand total Confirm Purchase? (y) Y 5. Show Star Wars and Hobbit via lookupbook to prove quantities updated. For this chapter's assignment (Ch 10) you will be adding single purchase functionality (only 1 book purchase per receipt) to the cashier module and convert your data structure to an array of classes. If multiple purchases of the same book are requested by the user, only show one instance of the book (with combined quantities) on the receipt (i.e.): Purchase Request: 2 x Star Wars Do you want to add another book to this purchase? (y) Y Purchase Request: 1 x Hobbit Do you want to add another book to this purchase? (y) Y Purchase Request: 3 x Star Wars Do you want to add another book to this purchase? (y) N **** RECEIPT *** Star Wars x 5 Hobbit x 1 ... Grand total .... Confirm Purchase? (y) Y subtract quantities from the actual book records in your array of classes. You must adhere to the UML provided below. I have recently updated the UML to convert bookCount into a static variable (private) that belongs to the bookType class along with a static getter and inc/dec methods. bookCount is only incremented/decremented via the increment and decrement static methods. serendipity(ch10) UML-1.pptx Sample Grading Metric 1. Show bookType.cpp and bookType.h (must adhere to standard) a. constructors b. setters/getters c. print (aka bookInfo) d. equals e. static data/function members 2. Show array of bookTypes declaration. 3. Fill array (copy/paste) with the 20 books. a. Try to add 21st book (should not allow) b. Delete Dark Force Rises book C. Add Tainted Sword 4. Purchase Request: 2 x Star Wars Do you want to add another book to this purchase? (y) Y Purchase Request: 1 x Hobbit Do you want to add another book to this purchase? (y) Y Purchase Request: 3 x Star Wars Do you want to add another book to this purchase? (y) N RECEIPT *** Star Wars x 5 (You get the idea) Hobbit x 1 Grand total Confirm Purchase? (y) Y 5. Show Star Wars and Hobbit via lookupbook to prove quantities updatedStep 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