If you are curious, the problem would have arised when units would have been a negative integer. In this case the variable discountPercent would not have been initialized.
Simply giving it a default...