Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Thank you!! Complete problem 23 on page 1099 ( http://www.chegg.com/homework

ID: 3684745 • Letter: C

Question

C++ Thank you!!

Complete problem 23 on page 1099 (http://www.chegg.com/homework-help/write-program-keep-track-hardware-store-inventory-store-sell-chapter-16-problem-23pe-solution-9781285852744-exc) with the following modifications:

Use the functions: (data file is also provided)

//getData() reads input file into vectors.

void getData(ifstream& inp, vector& iID, vector& iName,

             vector& pOrdered, vector& pInStore,

             vector& pSold, vector& manufPrice,

             vector& sPrice);

//sortData() sorts data in the vectors

void sortData(vector& iID, vector& iName,

             vector& pOrdered, vector& pInStore,

             vector& manufPrice,

             vector& sPrice);

//binSearch returns the index of the data entry if searchItem is found, otherwise it returns -1 (not found)

int binSearch(vector list, string searchItem);

//menu() displays menu

void menu();

//printReport() displays all of the data.

void printReport(const vector& iID,

                 const vector& iName,

                 const vector& pOrdered,

                 const vector& pInStore,

                 const vector& pSold,

                 const vector& manufPrice,

                 const vector& sPrice);

//makeSale() prompts user for item and number of pieces and displays the amount due (You don't need to remember total)

void makeSale(const vector& iName, vector& pInStore,

             vector& pSold, const vector& 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 . . .

Ch16_E23Data.txt :

1111
Dish Washer
20 250.50 550.50
2222
Micro Wave
75 150.00 400.00
3333
Cooking Range
50 450.00 850.00
4444
Circular Saw
150 45.00 125.00

Explanation / Answer

int getInput(istream& inp, vector<int>& itemID,
vector<string>& itemname,vector<int>& ordered,
vector<int>& instore, vector<int>& sold,
vector<double>& mprice,vector<double>& sprice)
{
vector v;
int myInt,count=0;
string str="";
char ch;
double myDouble;
inp.open(str.c_str());
while(inp>>itemID>>itemname>>ordered>>instore>>
sold>>mprice>>sprice)
{
v.push_back(itemID+ " "+item_name+ " " +
ordered+ " "+ instore+" "+ sold+ " "+ mprice+ " "
+sprice);
}
inp.close();
}


void printReport(vector<int>& itemID,
vector<string>& itemname,vector<int>& ordered,
vector<int>& instore, vector<int>& sold,
vector<double>& mprice,vector<double>& sprice, int count)
{
for(int i=0;i<=count;i++)
cout<<itemID<<itemname<<ordered<<
instore<<sold<<mprice<<sprice;
}

void sortInput(int count,vector<int>& itemID,
vector<string>& itemname,vector<int>& ordered,
vector<int>& instore, vector<int>& sold,
vector<double>& mprice,vector<double>& sprice)
{
std::vector<int>myvector (itemID,itemID+count);
std::sort(myvector.begin(),myvector.begin()+4);
}

void sellAnItem(vector<int> itemID,vector<int>& instore,
vector<int>& sold, int count)
{
vector v;
v.pop_back();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote