Ask Question
24 August, 23:13

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.

+3
Answers (1)
  1. 25 August, 01:44
    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?
Find 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 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