Ask Question
21 February, 01:45

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; }

+1
Answers (1)
  1. 21 February, 02:39
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers