Arduino+Xbee

I cant write the code if I dont know how its going to work with using xbee's

If you "know the ins and outs" of the ping sensor, it should be obvious that the XBee, by itself, will not get data from a sensor that needs to be an output device then an input device.

You can't upload code to the XBees, so writing code for them is not going to happen.