wrote and tested the sumSlice method