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
When you use the .net data provider objects to retrieve data from a database, you can store the data in an object called a?
Ainat [17]
Data set is the object that you can store data.
6 0
3 years ago
Reserve space in memory for a variable called UIN of size word. The initial value of UIN will be the sum of the digits in your U
sladkih [1.3K]

Answer:

Explanation:

See the attached picture for answer.

4 0
3 years ago
In object-oriented programming, what is a constructor?
hjlf

A constructor in object-oriented programming is a special method of a class or structure that initializes an object of that type. Basically, it resembles an instance method that usually has the same name as the class. In simple terms, it is a subroutine called to create an object.






3 0
4 years ago
Which is a function of network media?
Eduardwww [97]
The (main) function of the "network media" is the "<span> to transmit signals from device to device" because by doing this and allowing this to happen, this the signals would also send messages, and by this, it would then also be known as social media, and by this, it would be able to send pictures,  text, and etc. This would be the point of the "network media".</span>
5 0
3 years ago
Read 2 more answers
What groups have developed electrode idenfication systems?
Basile [38]

CH24. CH25. CH26. CH27. CH28. CH29. CH30. CH31.

5 0
4 years ago
Other questions:
  • Write a static method named textcount that takes a scanner representing a file as a parameter and that reports various statistic
    11·1 answer
  • What is the name of the feature that can be enabled on slower-speed WAN links to prevent a large data transfer from affecting th
    10·1 answer
  • What is looping? the rerecording of sound first recorded on set the recording of sound on set the process of combining different
    11·1 answer
  • Random letter of the alphabet for Python coding
    11·2 answers
  • What are some effective methods for scrolling? Check all that apply.
    6·1 answer
  • Insufficient vacuum will require the driver to _______________ to adequately activate the brakes?
    13·1 answer
  • Write a program to take in a time-of-day on the command-line as 3 integers representing hours, minutes, and seconds, along with
    13·1 answer
  • Name the major types of computer systems from slowest to fastest. ​
    9·1 answer
  • Difference between authentication and authorization.
    15·1 answer
  • Please help me to creat flow chart​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!