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
For all of you who listen to podcasts, when do you usually find time to do so?​
ss7ja [257]
Morning and afternoon commute times are obvious blocks of time that you can assume are used for listening to podcasts, but the answer will obviously vary widely based on individual habits and schedules.

Hope this helps
7 0
2 years ago
What is does ram means,??
jenyasd209 [6]
It means to roughly force something into place or an ungelded boy sheep XDDD
7 0
3 years ago
Read 2 more answers
How do you enlarge your screen if there is no control panel? Need desperate help!
igor_vitrenko [27]
You hit ctrl than the plus/equal sign Hope that helped! 
4 0
3 years ago
Which of the following describes the phishing method of information security crime?
Marianna [84]
<span>C. pretending to be someone else when asking for information</span>
3 0
3 years ago
Read 2 more answers
Nearly all personal computers are capable of serving as network servers.
Mashutka [201]
True
yes computers are capable of serving network servers.
6 0
3 years ago
Read 2 more answers
Other questions:
  • Is there such a thing as an ethical reason for unauthorized access into a computer system?
    15·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    14·2 answers
  • Describe network in terms of the class computer lab
    9·1 answer
  • Which of the following is NOT a component of a DFD?
    8·1 answer
  • What could be one rule to help your friend to blog safely
    6·2 answers
  • Blank is a type of drag and drop code to help beginner
    14·1 answer
  • New Top Level Domains (TLDs) are coordinated by:_______.
    10·1 answer
  • Ayúdenme porfa se los agradecería :c
    7·1 answer
  • Which type of evaluation requires that the program be fully implemented before the evaluation can begin
    9·1 answer
  • Why do we need to learn about engineering and technology?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!