All pastes #20834 Raw Edit

Something

public text v1 · immutable
#20834 ·published 2005-08-23 04:02 UTC
rendered paste body
A company stores sales data in a single, cumbersome file. Each line of the file represents one sale and is formatted as:
    CLIENT_ID CNT_1 PRODUCT_1 CNT_2 PRODUCT_2 ...
This indicates that CNT_1 units of PRODUCT_1 were sold to the client whose id is CLIENT_ID, and CNT_2 units of PRODUCT_2 and so on. You have been tasked with figuring out how many units of a particular product have been sold over time to a particular client. You will be given a String[] sales, a String, client, and a String, product. You are to return an int representing how many units of product were sold to client in sales.