posted 3 years ago
I think it's also worth mentioning that as Rico has done in his code, do not use a constant value (NUM_AMOUNT), instead opt for the use of the length property of your array in your for loops termination condition. This is always a safer bet in the case of array sizes changing. It's far more maintainable. If you decide that you need to add another element to your array, you then have to also change that constant value, which may not be a big deal, but it's best to get into the habit of always coding for easier maintainability.