Follow the instruction below to program to search for foreign…
Question Follow the instruction below to program to search for foreign… Follow the instruction below to program to search for foreign investment bank accounts in a national database file. Consider the following bank account record:struct Account { unsigned char m_bitPattern; int m_accNo; // account number double m_balance;};The database file can contain millions of the above records in binary format.The m_bitPattern attribute holds different information about the account in a bit pattern, each bit being 1 indicates the account has the property and 0 that it doesn’t. For example, the bit at index 3 indicates if the bank account is an RRSP account or not.// check the bit index n = 3if(m_bitPattern & (1u << n)){ // RRSP}else{ // not RRSP}Our focus is on the bit at index 2 that indicates if the bank account is a foreign investment or not.Note: The bit at index 0 is the least significant bit. Your TasksInsertion operator overloadOverload the insertion operator for std::ostream to insert the Account into the stream using the following format:999999: !!!! (1234.56)where:9 is the bank account number! is the bit pattern at indices 3 to 0 of the m_bitPattern attribute ('|' is displayed for 1 and '-' is displayed for 0)(1.1) is the balance For example, an account with the following values: "814588" (the number), 5 (the m_bitPattern), and 21927.40 (the balance) is printed as follows (which is a foreign bank account because bit at index 2 is set):814588: .!.! (21927.40)with the bit indices:.!.!3210 The BankAccounts classbuild class called BankAccounts that encapsulates a dynamic array of Account objects (store the address of the array in an attribute). Add to the class the members:Constructor: the class is instantiated using an opened binary std::ifstream following RAII (Resource Acquisition Is Initialization) which fills the class with a dynamic array of Accounts from the ifstream argument (to the exact number of records in the file; calculate the exact number of records using the file size and the size of of an instance of ty pe Account). If the ifstream object is not in a good state, the current instance is set into an empty state. a query called size that returns the number of Account elements.a subscript operator ([]): retrieve the Account at a specified index (unsigned integer) received as parameter. The access is read-only. If the parameter value goes out of range, this function should loop back to the beginning of the array. For example, if the current instance contains 100 accounts, then for the parameter value 100, the element at the index 0 should be returned.the BankAccounts class can not be copied, assigned or moved. The global foreignInvestment functionbuild function that can search in a BankAccounts instance for Account elements that contain a bit pattern with a the bit at index 2 set to 1. These elements should then be inserted into an std::vector of Accounts; the function should return this vector. The function should receive 3 parameters:an un-modifiable reference to a BankAccounts objectfrom: the index of the Account element to start the search fromto: the index of the Account element to end the search atStart from from index and check the m_bitPattern of each element of the BankAccounts object up to and including the to index. If the bit at index 2 is 1 in the m_bitPattern, insert the element into result vector. The multi-task search programComplete the following program to search in a BankAccounts instance using the foreignInvestment function by dividing the elements of BankAccounts into three groups to be searched by three asynchronous tasks.int main(){// open data file// instatiate BankAccounts class// create three "future" objects to recieve the return value of foreignInvestment function calls// run three asynchronous tasks on 1/3 of the data each and store the results in the futures// display the objects in the three futures as the result of the search}Using the provided input file, a correct implementation of the above requirements should produce the following output on first lines (the actual output contains more lines):Foreign bank accounts:1: 814588: .!!! (927.40)2: 811160: .!.. (77.16)3: 823549: .!.. (112.22)4: 824753: .!.. (635.06)5: 807942: .!!. (730.24)6: 832274: .!!. (352.34)7: 818555: !!.. (772.09)8: 804868: .!.. (8.15)9: 827410: .!.. (258.15)10: 814832: !!.. (476.91) Computer Science Engineering & Technology C++ Programming OOP 345 Share QuestionEmailCopy link Comments (0)


