So I already have most of the code and now I have to: 1. create an index file to keep track of all the inventory IDs and their locations 2. modify my class to be able to display any record with a given ID without searching through the entire file // This program displays the contents of the inventory file. #include #include #include using namespace std; class DB{ // Declaration of InventoryItem structure class InventoryItem { public: char Id[5]; char desc[31]; int qty; float price; }; string DBname; fstream inventory;// (DBname, ios::in | ios::binary); public: DB(string N){ DBname = N; }// constructor private:void Input(InventoryItem &Inv) { cout << \"Please type Id\" << endl; cin >> Inv.Id; cout << \"Please type Desc\" << endl; cin >> Inv.desc; cout << \"Please type qty\" << endl; cin >> Inv.qty; cout << \"Please type price\"<> Inv.price; } public: void Create(int Nrec) { inventory.open(DBname, ios::out | ios::binary); // fstream inventory(\"Inventory.dat\", ios::out | ios::binary); InventoryItem record = { \"\", \" \", 0, 0.0 }; // Write the blank records for (int count = 0; count < Nrec; count++) { Input(record); cout << \"Now writing record \" << count << endl; inventory.write(reinterpret_cast(&record), sizeof(record)); } // Close the file. inventory.close(); return ; } public: void Display() { inventory.open(DBname, ios::in | ios::binary); InventoryItem record = { \"\",\"\", 0, 0.0 }; // Now read and display the records inventory.read(reinterpret_cast(&record), sizeof(record)); while (!inventory.eof()) { cout << \"Inventory Id: \"; cout << record.Id << endl; cout << \"Description: \"; cout << record.desc << endl; cout << \"Quantity: \"; cout << record.qty << endl; cout << \"Price: \"; cout << record.price << endl << endl; inventory.read(reinterpret_cast(&record), sizeof(record)); } // Close the file. inventory.close(); return; } }; int main() { DB Mydb(\"Inventory.dat\"); // declare a database Mydb.Create(3); // load data cout << \"***** display ***\" << endl; Mydb.Display(); // print entire database // implement the following function // Mydb.Show(\"AB001\"); // display record with given ID char C; cin >> C; return 0; } Solution Programming Code in C++ #include #include #include #include #include #include using namespace std; //Structure. struct InvStruct { string iName; int iQuantity; double iPrice; }; const int MAXSIZE = 9; void addToInventory(InvStruct aList[], int& aSize); void displayInventory(const InvStruct aList[], int aSize); void saveToFile(const InvStruct aList[], int aSize); void openAFile(InvStruct aList[], int& aSize); char menuResponse(); int main(int argc, char *argv[]) { InvStruct iRecords[MAXSIZE]; int noOfRec = 0; bool reRun = true; do { cout << \"Inventory has \" << noOfRec << \" items\" << endl; switch (menuResponse()) { case \'A\': addToInventory(iRecords, noOfRec); break; case \'D\': displayInventory(iRecords, noOfRec); break; case \'O\': openAFile(iRecords, noOfRec); break; case \'S\': saveToFile(iRecords, noOfRe.