updated Main.java in Assignment 2