Some Java Code done for class assignment