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
steposvetlana [31]
4 years ago
13

Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable

s neutral, base, and acid: 0,0,1 if pH is less than 7 0,1,0 if pH is greater than 7 1,0,0 if pH is equal to 7 History:
Computers and Technology
2 answers:
levacccp [35]4 years ago
4 0

Answer:

if (pH<7.0){

          neutral=0;

          base=0;

          acid=1;

      }

      else if (pH>7.0){

          neutral=0;

          base=1;

          acid=0;

      }

      else if (pH==7.0){

          neutral=1;

          base=0;

          acid=0;

      }

Explanation:

As required by the question, if and else statements have been used to test the value of the pH and assign the apropriate values to the variables neutral, base and acid.

The code snippet below can be used to prompt the user to enter values for pH

<em>import java.util.Scanner;</em>

<em>public class pHTest {</em>

<em>   public static void main(String[] args) {</em>

<em>      Scanner scr = new Scanner(System.in);</em>

<em>       System.out.println("Enter a value for the pH");</em>

<em>       int neutral, base, acid;</em>

<em>       double pH = scr.nextDouble();</em>

<em> if (pH<7.0){</em>

<em>           neutral=0;</em>

<em>           base=0;</em>

<em>           acid=1;</em>

<em>       }</em>

<em>       else if (pH>7.0){</em>

<em>           neutral=0;</em>

<em>           base=1;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>       else if (pH==7.0){</em>

<em>           neutral=1;</em>

<em>           base=0;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>} }</em>

san4es73 [151]4 years ago
3 0

Answer:

Their answeres choices

Explanation:

You might be interested in
What inventor patented the first American movie projector?
yulyashka [42]
Thomas edison is the answer
3 0
3 years ago
Read 2 more answers
Which file extension takes less storage space?
anyanavicka [17]

I believe the answer would be the JPEG file extension.

4 0
3 years ago
Read 2 more answers
Which of these can be represented visually by a flowchart?
Mariana [72]

Answer:

i think its C.

if its wrong i'm truly sorry

Explanation:

4 0
3 years ago
Read 2 more answers
The process of converting information from a form/questionnaire is referred to as data preparation. This process follows a four-
Sergio [31]

Answer:

Data tabulation.

Explanation:

6 0
3 years ago
Which term refers to the data stored in computer memory on which the processor applies to program instructions
Fed [463]
The answer is B.) variable.
3 0
3 years ago
Other questions:
  • If you interview a dentist to learn about her experiences on the job, she is considered a secondary source of information. Pleas
    7·2 answers
  • Which file type is typically used for videos? GIF MPEG MP3 PDF
    8·1 answer
  • You have to calculate the total amount you spent at the mall today. Which function should you use to do so?
    6·2 answers
  • Which is a benefit of traditional SLR cameras over digital cameras? A. They produce negatives to serve as backups. B. They make
    6·1 answer
  • In addition to paying $100 per month for health insurance, sam is responsible for paying her first $500 of medical bills every y
    10·1 answer
  • Which browser should you choose if you want all viewing information except thumbnail previews of websites?
    15·2 answers
  • Nonverbal communication includes _____.
    9·2 answers
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • From space, the world looks very different. Describe what these surfaces look like from an airplane’s view:
    13·2 answers
  • HELLLLLLLLPPPPPPPPPPPP HHHHHHHHHEEEEEEEEELLLLLLPPPPPP MEEEEEEEE
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!