1. how to i make both the computers to communicate (Sharing folders)
You need to have a look at NFS (Network File System) or Samba to share folders between the two PC's.
2. How do i make the computeer connected to the internet a gatewway for the 2nd computer
At a guess you would need to enable IP forwarding in the kernel:
echo 1 > /proc/sys/net/ipv4/ip_forward (as root)
and then set the gateway on the second PC to the IP address of the first/routing PC.
You will also need to setup a new route on the second PC, to do this use the "route add..." command but I'll let you have a read up on that since I'm not sitting at a linux machine and can't remember what exactly is needed.
Off the top of my head that should do it, aswell as any firewall configuration alterations you might need to make depending on how your firewalls setup.