Basic Math/Ace interview math test
Ace hardware sells wrenches for ($86) and hammers for ($300). Ordered were 45 cartons total. $9200 was spent in total. how much was spent on each hammers and wrenches?
Let x=# of wrenches purchased, and y=# of hammers purchased.
Thus, we get for the total cost: 86x + 300y = 9200 or 43x + 150y = 4600, after dividing by 2.
The 45 carton info is useless, since we do not know anything about how many wrenches or hammers
each carton can contain.
Therefore, we only have 43x + 150y = 4600, with the fact x & y must be non-negative integers
(i.e. we cannot buy a negative quantity of an item nor can we buy a fractional amount).
Solving the equation for x gives: x = (4600-150y)/43 = 4600/43 - 150y/43 = 106 + 42/43 - 3y - y/43.
Or, x = 106 - 3y + (42-21y)/43 = 106 - 3y + 21(2-y)/43. y can only be 0, 1, 2, 3, ... and
we need (2-y)/43 to be an integer. Thus, y can be 2 or 45 or ..., but 45 is too big, since that
would make x negative. Hence, y=2 making x=100.
Answer: 100 wrenches and 2 hammers.