A school assignment done in java