1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KonstantinChe [14]
3 years ago
7

Rewrite each condition below in valid Java syntax (give a boolean expression): a. x > y > z b. x and y are both less than

0 c. neither x nor y is less than 0 d. x is equal to y but not equal to z
Computers and Technology
1 answer:
Natali5045456 [20]3 years ago
4 0

Answer:

The boolean expression is the expression which can be evaluated to true or false. This true/false is called boolean value. An if statement is used to check a condition which often contains the boolean expression which can either evaluate to true or false.

<h2>a. x > y > z </h2>

This line means that the value of variable x is greater than the value of variable y and the value of variable y is greater than the value of variable z.

This means:

                            x is greater than y AND y is greater than z

                                                     x > y AND y > z

in JAVA                                         x > y && y > z

using if statement                        if(x > y && y > z)

it can also be written as:       if (x > y && x > z && y >z)

<h2>b. x and y are both less than 0</h2>

This statement means that the value of variable x and the value of variable y are less than 0

This means:                                   (x AND y) = 0

in JAVA                                          (x&&y)==0

using if statement:                 if ((num&&hum)==0)

This can also be written as       x < 0 AND y < 0

 In JAVA                                         x  < 0 && y < 0

using if statement                       if (x < 0 && y < 0)

<h2>c. neither x nor y is less than 0</h2>

This statement means that neither the value of x variable nor the value of y variable is less than 0. This clearly means that the value of x and value of y both values are greater than or equal to 0.

this means:

                                                 x > = 0 AND y > = 0  

In JAVA                                      x > = 0 && y > = 0

Using if statement                     if(x > = 0 && y > = 0)

It can also be written as                    (x && y > = 0)

                                                         if(x && y > = 0)

<h2> d. x is equal to y but not equal to z</h2>

This statement means that the value of x is equal to the value of y but the value of x is not equal to the value of z.

This means

                                                         x = y but x ≠ z

                                                         x=y AND x≠z

In JAVA                                              x==y && x!=z

Using if statement                           if (x == y && x != z)

it can also be written as                    if (x == y && y != z)

If x is equal to y so this means that the value of x and y will be the same and both the values will not be equal to the value of z.

You might be interested in
What allow you to write alphas on a computer keyboard
lions [1.4K]

Answer:

"To create any of these Greek letters using the Alt codes, simply press the "Alt" key while simultaneously typing the listed number. For example, to create the Greek letter Alpha (α), press the "Alt" key and type 224 using the keypad at the right side of your keyboard." - GOOGLE

5 0
3 years ago
Two numbers are given (numbers are entered from the keyboard). If both numbers are positive, then output their sum, if both numb
AleksAgata [21]

Answer:

The program in Python is as follows:

num1 = int(input())

num2 = int(input())

if num1 >=0 and num2 >= 0:

   print(num1+num2)

elif num1 <0 and num2 < 0:

   print(num1*num2)

else:

   if num1>=0:

       print(num1**2)

   else:

       print(num2**2)

Explanation:

This gets input for both numbers

num1 = int(input())

num2 = int(input())

If both are positive, the sum is calculated and printed

<em>if num1 >=0 and num2 >= 0:</em>

<em>    print(num1+num2)</em>

If both are negative, the products is calculated and printed

<em>elif num1 <0 and num2 < 0:</em>

<em>    print(num1*num2)</em>

If only one of them is positive

else:

Calculate and print the square of num1 if positive

<em>    if num1>=0:</em>

<em>        print(num1**2)</em>

Calculate and print the square of num2 if positive

<em>    else:</em>

<em>        print(num2**2)</em>

3 0
3 years ago
1. Which of the following accurately describes a piece of work that contains a Creative Commons: No Derivative Works license?
frez [133]
1. B
2. C
3. C
Just did the test, these are the right answers!
3 0
3 years ago
Read 2 more answers
What’s unique about windows 8 compared to earlier windows
skad [1K]
New Interface, features like start screen, faster boot time, dynamic desktop, improved search function, windows love syncing, windows to go, and improved security.
7 0
3 years ago
Programming terms!!Please need help!!!
Alexeev081 [22]
1 algorithm
2 sequential
3 selection
4 loop
5 boolean
6 variables
7 expression
8 concatenation
9 operator
10 function
11 argument
12 event
13 event handler
14 class
15 object
16 instance
17 properties
18 methods
19 parameters
8 0
3 years ago
Other questions:
  • Write a C++ program that reads students' names followed by their test scores. The program should output each students' name foll
    9·1 answer
  • • Two advertisers A and B
    8·1 answer
  • A spreadsheet can be filtered only by one column at a time? <br> true or false
    14·2 answers
  • how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
    13·1 answer
  • Please write down a java program for below instruction.Min-Heap: Construct a Min_Heap from the following set of integers. Rememb
    5·1 answer
  • During his last performance review, Franco's boss urged him to set some short-term and long-term sales goals to help him perform
    6·2 answers
  • Why is it preferable to code web pages in HTML format?
    10·2 answers
  • Hoda needs to create a chart that is associated with an Excel spreadsheet. She needs to ensure that if the data in the spreadshe
    12·1 answer
  • Keyshia wants to add movement to her PowerPoint presentation. Which tab should she use to complete this task
    15·2 answers
  • How do you properly turn off a computer?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!