Hello and Welcome to LinuxQuestions,
Have you given the fact that your teacher might also be a member of LQ a thought? We will not do your homework for you, if you cannot find the answers yourself then you need to study and try more. It's against the LQ rules to post homework just as it is and you'll not find lots of help here.
Look into output redirection and the sort command, or even the man pages of ls.
Have a look at awk and sort.