Danielle spent three times as much on transportation as she did on lunch, so we can call this 3x.
She spent $4 less than on books than she did on transportation -> 3x - 4
So, she spent x + 3x + 3x - 4 (simplified as 7x - 4).
Danielle had $59 to spend last week -> 7x - 4 = 59
Solve for x : (59+4)/7 = 9
So, she can spend at max $9 on lunch
Recheck : 9 + 27 + 27 - 4 = 63 - 4 = 59.