Ask Question
11 May, 00:02

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. 11 May, 01:08
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers