Ask Question
2 July, 23:04

What will be the value of discountRate after the following statements are executed? double discountRate = 0.0; int purchase = 100; if (purchase > 1000) discountRate = 0.05; else if (purchase > 750) discountRate = 0.03; else if (purchase > 500) discountRate = 0.01;

+1
Answers (1)
  1. 3 July, 02:52
    0
    The value of discountRate after the following statements are executed

    double discountRate = 0.0;

    int purchase = 100;

    if (purchase > 1000) discountRate = 0.05;

    else if (purchase > 750) discountRate = 0.03;

    else if (purchase > 500) discountRate = 0.01;

    is 0.0

    Explanation:

    The discount rate is declared as a double; double discountRate = 0.0;

    The purchase is declared as integer; int purchase = 100;

    The first if statement shows if purchase > 1000 then the discountRate is 0.05

    The second if statement shows if purchase > 750then the discountRate is 0.03

    The third if statement shows if purchase > 500 then the discountRate is 0.01

    Since none of these statements are true, the original discountRate is printed.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will be the value of discountRate after the following statements are executed? double discountRate = 0.0; int purchase = 100; if ...” 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