Since you change your network connection often, it makes little sens to use a static IP configuration. You see, when you change configuration in /etc/network/interfaces, you certainly need to specify the network and the gateway, besides mask and your own address (plus, if you wish, broadcast and dns-nameservers). The first three specs (gateway, network, mask) change from LAN to LAN, so it is possible that your chosen IP address belongs to a completely different network: in this case, you would be left incommunicado.
Also, it is possible that your chosen address is already taken, which would cause a number of difficult-to-diagnose malfunctions (just try it once, for pure fun, you'll see it).
As for syntax, a correct, simple configuration is:
iface eth0 inet static
dns-nameservers 18.104.22.168 22.214.171.124
to which you may add pre-up/post-up/pre-down/post-down to specify actions to be executed before/after connection/disconnection.
If however you insist on retaining your xxx.xxx.xxx.145 address, you will have to learn how to listen to a network without having a proper IP address, to discover whether a 145 address has been given to someone already.