Conversion Factors.
1 cup = 8 fluid ounces.
4 cups = 1 quart
4 quarts = 1 gallon
Solution
Use a method call unit fractions. It is simple to use. All you do is arrange the fraction so that 1 part of the unit fraction on the right cancels with 1 part of the fraction on its left. Then divide the numerator by the denominator when each has been multiplied. All this will become clearer if you follow the example below.

numerator: 5 * 4 * 4 * 8 * 1 = 640
denominator: 1 * 1 * 1 * 1 * 4 = 4
Answer: numerator/ denominator = 640/4 = 160 glasses / 5 gallons.