Ask Question
17 July, 20:11

Code a Boolean expression that tests if a decimal variable named currentSales is greater than or equal to 1000 or a Boolean variable named newCustomer is equal to true. Code this statement so both conditions will always be tested, and code it in the shortest way possible]

+1
Answers (1)
  1. 17 July, 23:33
    0
    Given

    Decimal variable: currentSales

    Decimal test value: 1000

    Boolean variable: newCustomer

    Boolean default value: true

    The following code segment is written in Java

    if (currentSales = = 1000 || newCustomer)

    {

    //Some statements

    }

    The Program above tests two conditions using one of statement

    The first condition is to check if currentSales is 1000

    = = Sign is s a relational operator used for comparison (it's different from=)

    || represents OR

    The second condition is newCustomer, which is a Boolean variable

    If one or both of the conditions is true, the statements within the {} will be executed

    Meaning that, both conditions doesn't have to be true;

    At least 1 condition must be true for the statement within the curly braces to be executed
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Code a Boolean expression that tests if a decimal variable named currentSales is greater than or equal to 1000 or a Boolean variable named ...” in 📙 Engineering 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