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
In one week, your company received the following quantities of e-mail messages. Monday 240 Tuesday 315 Wednesday 290 Thursday 18
Vika [28.1K]

Answer:

280

Explanation:

Average = (240 + 315 + 290 + 180 + 375) ÷ 5

= 1400 ÷ 5

= 280

Cheers

3 0
3 years ago
Please pass this on... ( #helpsavelives )
olya-2409 [2.1K]

Answer:

Thank you

Explanation:

That made my day. I will make sure to pass it on.

4 0
3 years ago
Place the steps in order for adding an additional email account in outlook
Zielflug [23.3K]

Answer:

Give Thanks to JessicaRoberts715

1. Click the file tab

2. Click the add account button

3. Type the account information

4. Outlook will auto-configure the account

5. A new account appears in the folder list

6 0
3 years ago
What new information, strategies, or techniques have you learned that will increase your technology skills?
marshall27 [118]
You can try programming
6 0
3 years ago
Will a logic error be found if a program is compiled?
natali 33 [55]
No. The computer dose not understand what you are attempting to do, therefore it will not understand how to check for logic errors. The compiler will only check for syntax errors.
6 0
3 years ago
Other questions:
  • A well-diversified portfolio needs about 20-25 stocks from different categories is this True or False?
    6·2 answers
  • The global network that links millions of computers is the
    9·2 answers
  • What are the basic tools for coding HTML manually?
    10·2 answers
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • You are purchasing several PC systems that will be used as thin clients in a large organization. Which hardware selection criter
    9·1 answer
  • A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, the number 5 is prime be
    11·1 answer
  • A certain manager makes the following statement "Our internet company is in business for the money, making profits, and making t
    13·1 answer
  • What is generation of computer ?​
    7·2 answers
  • A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
    8·1 answer
  • What is a cookie? *
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!