Ask Question
17 August, 00:53

Write one or more C+ + statements that assign the correct value to discount, using the logic described here (6pts) : Assign. 20 to discount if quantity equals 5 and price is $100 or more. Assign. 15 to discount if quantity is anything else and price is $100 or more. Assign. 10 to discount if quantity equals 5 and price is less than $100.

+4
Answers (1)
  1. 17 August, 02:51
    0
    Following statements are in C++.

    if (price>=100 && quantity = =5)

    {

    discount=.20;

    }

    if (quantity!=5 && price>=100)

    {

    discount=.15;

    }

    if (quantity = = 5 && price<100)

    {

    discount=.10;

    }

    Explanation:

    I have used three if conditions to handle three cases provided in the question. I have used assignment operator, AND operator (&&), not equal to operator (!=), greater than or equal to operator (>=), less than operator (<) to check the values of quantity and price.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write one or more C+ + statements that assign the correct value to discount, using the logic described here (6pts) : Assign. 20 to discount ...” 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