Added functions to Task2.java