+1 (208) 254-6996 essayswallet@gmail.com
  

Follow the instruction below to write aprogram to search for stolen… Follow the instruction below to write aprogram to search for stolen credit cards in a database file. The binary input file has been attached to this question. Click CC.bin to download it!Consider the following credit card record:struct CreditCard {   unsigned int m_bitPattern;   unsigned long long m_ccNo; // CC number };The database file can contain millions of the above records in binary format.The m_bitPattern attribute holds different states of the card in a bit pattern, each bit being 1 indicates the state is active and 0 is inactive. For example, bit index 2 could indicate if the credit card is expired or not.// check the bit index n = 2 if(m_bitPattern & (1u << n)) {    // expired } else {    // valid }Our focus is on the bit at index 4 that indicates if the credit card is stolen or not.Note: Only the first 6 bits of the m_bitPattern are used in this record.Note: The bit at index 0 is the least significant bit.Your TasksInsertion operator overloadOverload the insertion operator for std::ostream to insert the CreditCard into the stream using the following format:9999999999999999: ||||||where:9 is the credit card number, a 16-digit integer;| is the bit pattern at indices 5 to 0 of the m_bitPattern attribute ('|' is displayed for bit 1 and '-' is displayed for bit 0)The CCIndex classCreate aclass called CCIndex that encapsulates a dynamic array of CreditCard 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 CreditCards 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 type CreditCard). 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 CreditCard elements.a subscript operator ([]): retrieve the CreditCard 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 credit cards, then for the parameter value 100, the element at the index 0 should be returned.the CCIndex class can not be copied, assigned or moved.The global findStolen functionCreate afunction that can search in a CCIndex instance for CreditCard elements that contain a bit pattern with a the bit at index 4 set to 1. These elements should then be inserted into an std::vector of CreditCards; the function should return this vector.The function should receive 3 parameters:an un-modifiable reference to a CCIndex objectfrom: the index of the CreditCard element to start the search fromto: the index of the CreditCard element to end the search atThe multi-task search programComplete the following program to search in a CCIndex instance using the findStolen function by dividing the elements of CCIndex into four groups to be searched by four asynchronous tasks.int main() { // open data file // instatiate CCindex class // create four "future" objects to recieve the return value of findStolen function calls // run four asynchronous tasks on 1/4 of the data at a time and store them in the futures // display the objects in the four 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):Stolen credit cards: 1: 4520260616333137: -||--| 2: 4520961117062648: -|-||- 3: 4520337538346053: -|-|-- 4: 4520410517948829: -|---- 5: 4520299544262628: -||--| 6: 4520165722664037: -|-|-- 7: 4520263690321414: -|--|- 8: 4520314410991744: -|---- 9: 4520887709561179: -||--- 10: 4520164314988937: -|---- Computer Science Engineering & Technology C++ Programming OOP 345

Don't use plagiarized sources. Get Your Custom Essay on
Top answer: Follow the instruction below to write aprogram to search for stolen…
Just from $10/Page
Order Essay

Order your essay today and save 10% with the discount code ESSAYHELP