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.

Respuesta :

Answer:

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.