Ask Question
15 May, 03:58

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.1 * price; } else { discount = 0; } double discount = 0.10 * price; if (price < = 100) { discount = 0; }

+2
Answers (1)
  1. 15 May, 05:19
    0
    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;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A store provides 10 percent discount on all items with a price of at least $100. No discount is otherwise applicable. Which of the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers