This sounds like homework, if this is the case NOTE:It's not this forums policy to do others homework. If you have a script started maybe show what you have and I'm sure people will be glad to help point you in the right direction.
2. script to find users with their respective PID's
Do a search on the cut
command, or just look at the man page.