CS curriculum homework re-written in JAVA