Don't rent your teacher's car; that's just asking for trouble. And teachers, don't rent cars to students.
Let d be the number of days the car is rented for and m the number of miles it was driven while rented.
R.O.R. car costs in $:
R = 25d + 0.50m
Teacher car costs in $:
T = 0.03 · 2^m
where the caret ^ of course means exponentiation.