Ask Question

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. 27 August, 09:38
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers