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
(HELP ASAP) Jenae is helping her dad create a blog for his garden club. Which tool will she use?
ser-zykov [4K]
She would make use of JavaScript if she wants to make it interactive, CSS if she wants to design it, Text editor obviously for coding the blog and a web browser for the result hope this helps
7 0
2 years ago
Read 2 more answers
...........is a systems development technique that tests system concepts and provides an opportunity to examine input, output, a
EleoNora [17]

Answer:Prototyping

Explanation:Prototyping is the software activity in which there is the production of the prototypes which has the incomplete form of application .It is used for the development of the real-world operating system and used in the field of the software development. It provides the benefit to the user by examining about the product's reliability , output, input etc .

3 0
3 years ago
What do the last two steps in the cyclical design process most likely involve
zlopas [31]

Answer:

Well you would want to test the design, so it would be "c" then "d"

Explanation:

I hope this helps.

8 0
1 year ago
How do you change a automatic transmission
irinina [24]

Answer:

ohhh ok to all transactions.

6 0
2 years ago
Using logical operators, 1 AND 0 =
g100num [7]
O. In an AND gate both values need to be 1 to equal 1.
4 0
2 years ago
Other questions:
  • Two electronics technicians are looking at the representations of a silver atom and a copper atom in the figure above. Technicia
    10·1 answer
  • If you have a mix of 32-bit and 64-bit versions of windows, which architectures should you add a unattended installation file fo
    7·1 answer
  • To paste text with the same formatting as the document in which it is entered, select _____ from the Paste menu. Keep Source For
    12·2 answers
  • In mathematics, "quadrant I" of the cartesian plane is the part of the plane where x and y are both positive. Given a variable,
    11·1 answer
  • A standard for compressing music into computer files that can be easily exchanged on the Internet is called a(n) ______. A. musi
    5·1 answer
  • PERGUNTA 1
    15·1 answer
  • In 2-5 paragraphs, describe how you would create a new database using your software.
    9·1 answer
  • computer is an electronic machine that is used for data processing to produce meaningful information explain in statement​
    5·1 answer
  • Unit 2: Lesson 6 - Coding Activity 1
    10·1 answer
  • Which of the statements below is true?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!