Ask Question

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.

+4
Answers (1)
  1. 6 November, 18:56
    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?
Find 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 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