A store provides 10 percent discount on all items with a price of at least $100. No discount is otherwise applicable. Which of the following DOES NOT correctly compute the discount? Group of answer choices double discount = 0; if (price >= 100) { discount = 0.10 * price; } double discount; if (price < 100) { discount = 0; } else { discount = 0.10 * price; } double discount = 10; if (price >= 100) { discount = 0.1 * price; } else { discount = 0; } double discount = 0.10 * price; if (price <= 100) { discount = 0; }

Respuesta :

Limosa

Answer:

The last option of the following question is not correct, which  is:

double discount = 0.10 * price;

if (price <= 100)

{

discount = 0;

}

Explanation:

Because the formula of the discount is not initialized inside the condition section but, in the last option the formula is initialized at that time when the variable is declared.

This option may be right, if the formula is initialized inside the else section like:

double discount = 0;

if (price <= 100)

{

discount = 0;

}

else

{

discount = 0.10 * price;

}

Answer:

im sure since this question was 2 years ago you dont mind me snatching these points so i can level up. fanks