add try/catch method getFirstNum, call method in while loop