What don't you get? What logic are you having trouble conceptualizing? Simply posting your code and asking somebody the explain it is not the way it works. What are your errors? Where are the errors?...