?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Is There An Error?

APCSA-JT4GET

What is wrong with the following segment of code that is intended to print the income tax?

Assume that the income tax calculation is a straight-forward calculation of income times the income tax percentage.

final double INCOME_TAX_PERCENT = 7.60; // 7.60%
int income = // assume that a valid income has been assigned;

if (income > 25000)
    INCOME_TAX_PERCENT = INCOME_TAX_PERCENT +.01;
double incomeTax = income * INCOME_TAX_PERCENT / 100;
System.out.println(incomeTax);
A

There is nothing wrong with this code.

B

The calculation of incomeTax should not be divided by 100.

C

The value initially assigned to INCOME_TAX_PERCENT cannot be changed.

D

incomeTax should be declared as an integer, not a double.

E

incomeTax cannot be printed since it is not a string.