Java source code for project 2