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]
3 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]3 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]3 years ago
3 0

Answer:

Their answeres choices

Explanation:

You might be interested in
Steven is in a meeting and he is sharing a graph on his monitor with fifty other people. So that the others do not need to crowd
nevsk [136]
The answer is D) Projector because with a projector, its in the name project so it can anything u put on their, and put it on a virtual screen that can be put on a wall, so everyone can see.
8 0
3 years ago
In what ways do you think the media should function in a democratic society?
insens350 [35]

Answer:

i think it should slow down

Explanation:

i think this because people are always on social media so they should put down their devices and interact with others and sometimes they are violent on their devices so it would be better if people did stay off their devices for a little bit.

7 0
3 years ago
The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
SOVA2 [1]

Answer:

High level Language

understand

Explanation:

rocket is 0...4433456u888

5 0
2 years ago
Write the steps of applying background colour to the document?​
krok68 [10]

Answer:

Select add color

Explanation:

depends the program u are using

7 0
3 years ago
Read 2 more answers
If you have a database with birthdates, and you would like to find everyone who was born before June 16, 1967, what would you en
Tcecarenko [31]

Answer:

<June 16,1967

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • #A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
    5·1 answer
  • What is the definition of framerate?
    7·1 answer
  • What development in operating systems happened between the years 1990 and 2000?
    15·1 answer
  • The loss of privacy data has implications:
    5·1 answer
  • You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
    10·1 answer
  • DJ Davon is making a playlist for an internet radio show; he is trying to decide what 1212 songs to play and in what order they
    12·1 answer
  • Natalie is a secretary and must complete a large amount of filing this afternoon. At 1:00 PM, the office receptionist gets sick
    10·1 answer
  • Suppose that we are using PDDL to describe facts and actions in a certain world called JUNGLE. In the JUNGLE world there are 4 p
    7·1 answer
  • What is the two’s compliment of -95,-122,-111,-57
    9·1 answer
  • The ______ process retains copies of data over extended periods of time in order to meet legal and operational requirements.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!