Design patterns java assignment