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
Which question is MOST important for an office to consider when upgrading to new software
Marina CMI [18]
Either B or D those are the most reasonable answers if it were up to me to answer i would pick B but that is up to you go ahead and try your best i hope u have a nice day ✨✌️✨
6 0
3 years ago
What browser is included with windows?
alexandr402 [8]
Internet Explorer and the its version is dependent on the version of windows you are using.
7 0
4 years ago
What's the main idea??
tatyana61 [14]
My computer wont let me download this pdf

7 0
3 years ago
Which functions are available in a Word table? Check all that apply.
dexar [7]
All of them are available
3 0
3 years ago
Knowing how to develop an outline well is very easy, and most students can create quality outlines in one attempt. Please select
vovangra [49]

Its False, just took the test I chose true buh it told me I was wrong so iss gotta be false.

8 0
4 years ago
Read 2 more answers
Other questions:
  • When registering a new domain name, either the registrar's servers or self-owned servers can be used as name servers. What funct
    15·1 answer
  • List the six external parts or peripherals of a computer system
    13·1 answer
  • Professional photography is a competitive job field. <br> true <br> false
    12·2 answers
  • Two positive outcomes generally associated with modern computing are greater _____.
    12·2 answers
  • Sammy created a new logo for his client enlarged to use on a billboard ad. Now Sammy needs to redo the logo. What should he do t
    5·1 answer
  • Which line of code will print I can code on the screen?
    13·1 answer
  • In addition to MLA, what are some other widely used style guides? Check all that apply.
    5·1 answer
  • Plz answer me will mark as brainliest​
    13·1 answer
  • Manuel owns a small business. He needs to calculate the amount each employee owes in Federal taxes. Manuel should
    11·2 answers
  • Hiiiiiiiiihwdawdfgthnythgrfergthyjuhgfd
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!