- Indent code and insert comments to document your program.
- Program must be implemented and run as instructed.
- Source fileand executableare placed in a folder.
Write a program to keep track of a hardware store inventory. The store sells various items. For each item in the store, the following information is kept: item ID, item name, number of pieces ordered, number of pieces currently in the store, number of pieces sold, manufacturer’s price for the item, and the store’s selling price. At the end of each week, the store manager would like to see a report in the following form:
Friendly Hardware Store
itemID itemName pOrdered pInStore pSold manufPrice sellingPrice
4444 Circular Saw 150 150 0 45.00 125.00
3333 Cooking Range 50 50 0 450.00 850.00
*
*
*
Total Inventory: $###########.##
Total number of items in the store: _____
The total inventory is the total selling value of all of the items currently in the store. The total number of items is the sum of the number of pieces of all of the items in the store.
The program must be menu driven, giving the user various choices, such as checking whether an item is in the store, selling an item, and printing the report. After inputting the data, sort it according to the times’ names. Also, after an item is sold, update the appropriate counts.
Initially, the number of pieces (of an item) in the store is the same as the number of pieces ordered, and the number of pieces of an item sold is zero. Input to the program is a file consisting of data in the following form:
itemID
itemName
pOrdered manufPrice sellingPrice
Use seven parallel vectors to store the information. The program must contain at least the following functions: one to input data into the vectors, one to display the menu, one to sell an item, and one to print the report for the manager.
Complete the above problem with the following modifications:
Use the functions: (data file is also provided)
//getData() reads input file into vectors.
void getData(ifstream& inp, vectorint& iID, vectorstring& iName,
vectorint& pOrdered, vectorint& pInStore,
vectorint& pSold, vectordouble& manufPrice,
vectordouble& sPrice);
//sortData() sorts data in the vectors
void sortData(vectorint& iID, vectorstring& iName,
vectorint& pOrdered, vectorint& pInStore,
vectordouble& manufPrice,
vectordouble& sPrice);
//binSearch returns the index of the data entry if searchItem is found, otherwise it returns -1 (not found)
int binSearch(vectorstring> list, string searchItem);
//menu() displays menu
void menu();
//printReport() displays all of the data.
void printReport(constvectorint& iID,
constvectorstring& iName,
constvectorint& pOrdered,
constvectorint& pInStore,
constvectorint& pSold,
constvectordouble& manufPrice,
constvectordouble& sPrice);
//makeSale() prompts user for item and number of pieces and displays the amount due (You don't need to remember total)
void makeSale(constvectorstring& iName, vectorint& pInStore,
vectorint& pSold, constvectordouble& sPrice);
The following is a sample output:
Welcome to the Friendly Hardware Store!
Choose among the following options.
1: To see if an item is in the store.
2: To buy an item.
3. To check the price of an item.
4: To print the inventory.
9: To end the program.
4
Friendly Hardware Store
itemID itemName pOrdered pInStore pSold manufPrice sellingPrice
4444 Circular Saw 150 150 0 45.00 125.00
3333 Cooking Range 50 50 0 450.00 850.00
1111 Dish Washer 20 20 0 250.50 550.50
2222 Micro Wave 75 75 0 150.00 400.00
Total Inventory: $102260.00
Total number of items in the store: 295
Welcome to the Friendly Hardware Store!
Choose among the following options.
1: To see if an item is in the store.
2: To buy an item.
3. To check the price of an item.
4: To print the inventory.
9: To end the program.
1
Enter the name of the item: Circular Saw
Circular Saw is in store.
Welcome to the Friendly Hardware Store!
Choose among the following options.
1: To see if an item is in the store.
2: To buy an item.
3. To check the price of an item.
4: To print the inventory.
9: To end the program.
2
Enter the name of the item: Micro Wave
Enter the number of pieces: 2
Amount Due = $800.00
Welcome to the Friendly Hardware Store!
Choose among the following options.
1: To see if an item is in the store.
2: To buy an item.
3. To check the price of an item.
4: To print the inventory.
9: To end the program.
3
Enter the name of the item: Circular Saw
The price of Circular Saw = 125.00.
Welcome to the Friendly Hardware Store!
Choose among the following options.
1: To see if an item is in the store.
2: To buy an item.
3. To check the price of an item.
4: To print the inventory.
9: To end the program.
9
Press any key to continue . . .
1