What is the difference between a 3 pin and 4 pin ultrasonic range sensor?
It's simple enough... instead of:

pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);


You would have

pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);


(of course you have to define echoPin to be whatever pin you choose to connect ECHO to).

And to save processing time you can have all your pinMode() calls in setup since there is no need to change mode on the fly any more.