Question: using the source code at the bottom of this page, use the following instructions to make the appropriate modifications to the source code. Serendipity Booksellers
using the source code at the bottom of this page, use the following instructions to make the appropriate modifications to the source code.
Serendipity Booksellers Software Development
Project Part 7: A Problem-Solving Exercise
For this chapters assignment, you are to add a series of arrays to the program. For the time being, these arrays will be used to hold the data in the inventory database. The functions that allow the user to add, change, and delete books in the stores inventory will modify the data held in these arrays.
|
|
|
Understand the Relationship Between the Arrays
Add the following global arrays to the program:
bookTitle: An array of string objects that will hold the title of each book in the inventory.
isbn: An array of string objects that will hold the ISBN number of each book in the inventory.
author: An array of string objects that will hold the name of the author of each book in the inventory.
publisher: An array of string objects that will hold the name of the publisher of each book in the inventory.
dateAdded: An array of string objects that will hold the date each book was added to the inventory. The dates should be stored in the form MM-DD-YYYY. For example, April 2, 2012 would be stored as 04-02-2012.
qtyOnHand: An array of ints that will hold the quantity on hand of each book in the inventory.
wholesale: An array of doubles that will hold the wholesale price of each book in the inventory.
retail: An array of doubles that will hold the retail price of each book in the inventory.
Understand the Relationship Between the Arrays
The data stored in the arrays will be linked through their subscripts. The string stored in bookTitle[0] is the title of the book whose ISBN number is stored in isbn[0]. Likewise, the data stored in author[0], publisher[0], dateAdded[0], qtyOnHand[0], wholesale[0], and retail[0] also belong to that same book.
Modify the bookInfo Function
The bookInfo function currently displays the following screen:
|
Serendipity Booksellers Book Information
ISBN: Title: Author: Publisher: Date Added: Quantity-On-Hand: Wholesale Cost: Retail Price:
|
Modify the function so it has the following parameters:
isbn: a string object. The ISBN number of a book will be passed into this parameter.
title: a string object. The book title will be passed into this parameter.
author: a string object. The authors name will be passed into this parameter.
publisher: a string object. The publishers name will be passed into this parameter.
date: a string object. The date the book was added to inventory will be passed into this parameter.
qty: an integer. The quantity on hand of the book will be passed into this parameter.
wholesale: a double. The wholesale cost of the book will be passed into this parameter.
retail: a double. The retail price of the book will be passed into this parameter.
The program should display the data passed into its parameters in the following format:
Serendipity Booksellers
Book Information
ISBN: 1-999111-22-1
Title: Robert the Bruce, King of Scotland
Author: Haynes, Timothy
Publisher: Historical Publishers, Inc.
Date Added: 04-02-2012
Quantity-On-Hand: 20
Wholesale Cost: 15.50
Retail Price: 19.95
Here is the source code:
mainmenu.h
//functions used in the main function required for each menu option int reports(); //to report int booksInfo(); //gives books info int cashier(); //to calculate the price int invMenu(); //to perform inventory options
//stub functions for inventory void lookUpBook(); //to lookUp book void addBook(); //to add book void editBook(); //to edit book void deleteBook(); //to delete book
//Stub functions for reporting void repListing(); //to list books in inventory void repWholesale(); //to report wholesale value void repRetail(); //to report retail value void repQty(); //to report quantity void repCost(); //to report cost void repAge(); //to report age
mainmenu.cpp
#include
#include
#include "mainmenu.h" using namespace std;
int main() { int choice = 0, ret; while(choice!=4) { cout<<" \t Serendipity Booksellers" < //function bookInfo displays the information of book int bookInfo() { cout<<"\t Serendipity Booksellers" < //function inventory menu to display the inventory menu options int invMenu() { int choice = 0; while(choice!=5) { cout<<" \t Serendipity Booksellers" < int reports() { int choice = 0; while(choice!=7) { cout<<" \t Serendipity Booksellers" < //function cashier int cashier() { string date, ISBN, Title; int numOfBook; double price, subtotal, tax, total; int flag=1; while(flag==1) { cout<<"\tSerendipity Booksellers"< // setting to 2 decimal places in fixed point notation cout << fixed << setprecision(2); cout < //Stub functions for inventory menu options //function to lookup book void lookUpBook() { cout<<"You selected Look Up Book."; } //function to add book void addBook() { cout<<"You selected Add Book."; } //function to edit book void editBook() { cout<<"You selected Edit Book."; } //function to delete book void deleteBook() { cout<<"You selected Delete Book."; } //Stub functions for report options //function to list books void repListing() { cout<<"You selected Inventory Listing."; } //function to report wholesale value void repWholesale() { cout<<"You selected Inventory Wholesale Value."; } //function to report retail value void repRetail() { cout<<"You selected Inventory Retail Value."; } //function to report Quantity void repQty() { cout<<"You selected Listing By Quantity."; } //function to report cost void repCost() { cout<<"You selected Listing By Cost."; } //function to report age void repAge() { cout<<"You selected Listing By Age."; } Output: Serendipity Booksellers Main Menu 1. Cashier Module 2. Inventory Database Module 3. Report Module 4. Exit Enter Your Choice: 2 Serendipity Booksellers Inventory Database 1. Look Up a Book 2. Add a Book 3. Edit a Book's Record 4. Delete a Book 5. Return to the Main Menu Enter Your Choice: 1 You selected Look Up Book. Serendipity Booksellers Inventory Database 1. Look Up a Book 2. Add a Book 3. Edit a Book's Record 4. Delete a Book 5. Return to the Main Menu Enter Your Choice: 5 You selected item 5 Serendipity Booksellers Main Menu 1. Cashier Module 2. Inventory Database Module 3. Report Module 4. Exit Enter Your Choice: 4 You selected item 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
