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...

Themes are displayed in the Document Formatting group on the ________ tab

A) INSERT B) REVIEW C) DESIGN D) PAGE LAYOUT

Computer Science & Information Technology

Which of the following are benefits of using VPNs? (Choose all that apply.)

a. Eliminates the need for expensive dedicated WAN links b. Uses advanced encryption and authentication protocols c. Supports DSL and cable d. Cost savings using ISDN and PSTN connections e. Easy to add new users f. Cost savings using PVCs

Computer Science & Information Technology