Part A)
Distance is given as sum of total path length
So here as we are given that car drives 40 miles East and 30 miles West
So here the total path length is


Part B)
Displacement is given as straight line distance between initial and final position
So here we can see that
East
West
Now the total displacement will be

so the displacement will be 10 miles East