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

You might also like to view...

C++ has always had a built-in Boolean data type with two Boolean values, true and false.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Radio buttons are always created in a group with only one option present.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The ____ property contains the name of the object to be validated when using the RangeValidator control.

A. ControlToValidate B. MinimumValue C. Type D. ControlToCompare

Computer Science & Information Technology

Describe a block cipher counter (CTR) mode of operation.

What will be an ideal response?

Computer Science & Information Technology