Java version of the CP1200 2014 SP1 Assignment