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]

Respuesta :

Answer:

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

Q&A Education