First off, why are you using a for loop? This is a simple mathmatical equation.

You know that you will make $400 on the first $5k, $500 on the second. So

if(commissonwant < 0)
sale = 0;
else...