Let's call x the maximum amount of miles Karissa can drive without the cost of the rental going over $40.
Then since they charge $18.95 plus $0.18 for each mile, Karissa will pay, in dollars:
18.95 + 0.18x
So, the maximum value of x is the one for which the above expression equals 40:
18.95 + 0.18x = 40
Now, to solve this equation, we can apply a sequence of operations on both sides of the equation, until we isolate the variable x and find its value:
18.95 + 0.18x = 40
18.95 + 0.18x - 18.95 = 40 - 18.95
0.18x = 21.05
0.18x/0.18 = 21.05/0.18
x ≅ 116.94
Now, rounding the answer to the nearest mile, we find 117 miles.
Therefore, Karissa can drive a maximum of 117 miles without the cost of the rental going over $40.