The ‘Stores’ array at each station would already be sorted according to the lowest distance.
In order to avoid invalid entry by a customer, the station would present the customer with a fixed list of categories to choose the item from. When the customer selects an item from the list, a local search is conducted within the array ‘Items’ of the local database. In case of a match and if the available quantity is greater than 0, the information is presented to the customer. In case no match is found, the item is searched in the ‘Items’ array of the nearest remote store location i.e. on the server of the first store in the ‘Stores’ array. The search continues for all the stores in the array. Information is presented only if the item exists in a particular store. A while loop is used to traverse through all records of items and stores, while the matching conditions are checked through the ...Show more