If there is a modem in the apartment can you run ethernet to it??
If so just connect ethernet and use that..
OR.. if there is an apple store or apple supplier.. buy an airport Express.. it is cheap enough and will fix your problems in one of two ways..
Either by setting up in bridge direct to the modem.. you can then setup the express with wireless for your Mac.
Or you can use it as wireless to ethernet bridge.. and use ethernet on the Mac.. the former is probably best method but you may not have access to the modem.. no changes are made to modem settings.. you are simply plugging in an AP.
These issues are just plain old wireless.. sorry..
Your friend's Mac and your iphone etc.. are just different enough to work.
One thing you can try is to empty out all the existing names for wireless.. reboot the Mac and rediscover the wireless.. make sure the connection gives you a valid gateway and dns setting.. post a screenshot of it if you need help to determine if it is valid.
You can also test if it is working at least partly..
Open a terminal and type ping followed by the gateway IP address.
eg ping 192.168.1.1
Then ping the google DNS server which is 8.8.8.8
If that works then ping a website known to respond.
ping www.apple.com
PING e3191.dscc.akamaiedge.net (23.53.136.65): 56 data bytes
64 bytes from 23.53.136.65: icmp_seq=0 ttl=56 time=25.893 ms
64 bytes from 23.53.136.65: icmp_seq=1 ttl=56 time=26.658 ms
64 bytes from 23.53.136.65: icmp_seq=2 ttl=56 time=28.823 ms
64 bytes from 23.53.136.65: icmp_seq=3 ttl=56 time=29.344 ms
64 bytes from 23.53.136.65: icmp_seq=4 ttl=56 time=28.975 ms
^C
--- e3191.dscc.akamaiedge.net ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 25.893/27.939/29.344/1.390 ms
If you get ping response to an IP and no ping response to a name.. your DNS has failed.. use the google DNS in the wireless setup.