Why is using named constants a good programming practice?
What will be an ideal response?
Using named constants is a good programming practice because it is less prone to the
introduction of bugs into the source code. A retail program that calculates customer purchases needs
to include sales tax on the amount of purchase. The sales tax percentage seldom changes, therefore
using a named constant whose value is set once reduces the risk of the programmer mistyping the
percentage, which would in turn introduce a logic error, the hardest error to track.
Computer Science & Information Technology