Ask Question
15 May, 03:30

Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value - 1 or 1. - 1 represents the case where soldYesterday is greater than soldToday; 1 represents the case where soldYesterday is not greater than soldToday.

+2
Answers (1)
  1. 15 May, 04:35
    0
    if (soldYesterday > soldToday) {

    salesTrend = - 1;

    } else if (soldToday > soldYesterday) {

    salesTrend = 1;

    }

    Explanation:

    The if/else statement is more explicit. The first if condition check if soldYesterday is greater than soldToday, if true, then - 1 is assigned to salesTrend.

    Else if soldToday is greater than soldYesterday, if true, then 1 is assigned to salesTrend.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns ...” 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