Examlex

Solved

A Programmer Notices That the Following Code Snippet Uses the Same

question 13

Multiple Choice

A programmer notices that the following code snippet uses the same algorithm for computing cost after taxes, but with different variables, in the two places as shown below, and in several other places in the program. What could be done to improve the program?
Final double TAXRATE1 = 10;
Final double TAXRATE2 = 5.5;
Double subtotal = price * (1 + TAXRATE1) / 100;
Double total = subtotal + shipping * (1 + TAXRATE2) / 100;


Definitions:

Lookup

The process of searching for a piece of data within a database, array, or other data structures based on specific criteria.

Short Text

A data type in database systems used for text or combination of text and numbers that will not exceed a defined length.

Primary Key

A unique identifier for each record in a database table, used to ensure that each record can be uniquely distinguished from all others.

Report Label

A text element in database reporting tools used to identify or provide information about the data being displayed in a report.

Related Questions