let
x = the number of bags of candy
y = the number of bags of cookies
There were 3 more bags of cookies than candy sold:
y = x + 3
Bags of candy cost $7.50, and bags of cookies cost $4.50, and sales equaled $37.50:
7.50x + 4.50y = 37.50
by solving the system of equations:
y = x + 3
7.50x + 4.50y = 37.50
we find:
x = 2 bags of candies
y = 5 bags of cookies