Ask Question
26 March, 00:30

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]

+3
Answers (1)
  1. 26 March, 00:53
    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?
Find 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 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