Why are you using 2 while loops? You might want to consider looping through the list only once and doing an if-elseif statement, which would (if ordered correctly) do exactly what you want. Also,...