Is code written for NXT bricks compatible with EV3 brick (for Johnny 5 building)?
I would advise the EV3 retail version. An NXT costs more than it should because it is getting difficult to find. You can buy additional motors and sensors separately in an official LEGO store or order them from the S@H website. The EV3 education kit cost more than it should because it's "educational". You will not need to modify the Johnny 5 build much to accommodate for the different motors sensor and intelligent brick.  
No, but you'll be able to view the NXT code in the new software and it shouldn't be to hard to reproduce the EV3 equivalent. The code blocks are similar.
There is a new ultrasonic sensor (45504) just for the EV3 brick. It's sold as part of the educational kit but you can also buy it separately (which is in my opinion more cost effective). I suppose you could also modify the code to work with the EV3 IR sensor, but range and precision are significantly poorer for distance sensing. However with the IR, you can set it up to track the IR beacon, or you could use it as a remote control.