rewrite method to print all students using while or until