#ifndef ARITHCOLL_H_ #define ARITHCOLL_H_ #include #include //Purpose: An indexed collection of floats with addition and multiplication template class arithmetic_float_collection { private: float collection[N]; public: void store (int index, // IN: index of store in collection float value) // IN: value to be stored // Pre: Index must be greater than or equal to zero // and less than N; // Post: Legal floating point value is stored at // collection[index]. { if ((index < 0) || (index > N-1)) { cerr << endl; cerr << "*** ERROR: In arithmetic_float_collection::store: index" << endl; cerr << " is out of range. Execution terminated." << endl; exit(EXIT_FAILURE); } collection[index] = value; } // end store // RETRIEVE AN ITEM FROM DESIGNATED COLLECTION ELEMENT float retrieve (int index) // IN: index of retrieval // Pre: Index must be greater than or equal to zero // and less than N. // Post: Returns contents of cell indicated by index. { if ((index < 0) || (index > N-1)) { cerr << endl; cerr << "*** ERROR: In arithmetic_float_collection::retrieve: index" << endl; cerr << " is out of range. Execution terminated." << endl; exit(EXIT_FAILURE); } return collection[index]; } // end retrieve // RETURN THE NUMBER OF ELEMENTS STORED IN COLLECTION int get_count () { return N; } // end get_count void add( arithmetic_float_collection x, arithmetic_float_collection y ) { int i; for(i=0; i> new_component; store(i, new_component); } return; }//input void print() { int i; cout << "----------------"<