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
Design and implement an algorithm that gets a list of k integar values N1, N2,...Nk as well as a special value SUM. Your algorit
Fittoniya [83]

Answer:

The algorithm is as follows:

1. Start

2. Input List

3. Input Sum

4. For i = 0 to length of list - 1

4.1 num1 = List[i]

5. For j = i to length of list - 1

5.1 num2 = List[j]

6. If SUM = num1 + num2

6.1 Print(num1, num2)

6.2 Break

The algorithm is implemented in python as follows:

def checklist(mylist,SUM):

     for i in range(0, len(mylist)):

           num1 = mylist[i]

                 for j in range(i+1, len(mylist)):

                       num2 = mylist[j]

                       if num1 + num2== SUM:

                             print(num1,num2)

                                   break;

Explanation:

I'll explain the Python code

def checklist(mylist,SUM):

This line iterates from 0 to the length of the the last element of the list

     for i in range(0, len(mylist)):

This line initializes num1 to current element of the list

           num1 = mylist[i]

This line iterates from current element of the list to the last element of the list

                 for j in range(i+1, len(mylist)):

This line initializes num1 to next element of the list

                       num2 = mylist[j]

This line checks for pairs equivalent to SUM

                       if num1 + num2== SUM:

The pair is printed here

                             print(num1,num2)

                                   break;

6 0
3 years ago
Rewrite the Espresso Counter program to Swap or interchange any two rows of the output. Copy and paste just the interchanged par
seraphim [82]

Answer:

Rewrite the Espresso Counter program to Swap or interchange any two rows of the output. Copy and paste just the interchanged parts of the code. Compile and run the modified program. Copy and paste the new user interface output. Add a new row to the Espresso Counter user interface. Describe your modifications. Compile and run the new program. Copy and paste

1. Your modifications

2. Snapshots of your new counter interface.

4 0
2 years ago
Evaluate if the following function is a good candidate to be placed in a library. Why or why not?
Anastaziya [24]

Answer:

No, this would not be a good candidate because it can't be used in creating new programs.

Explanation:

^

8 0
3 years ago
Read 2 more answers
Ushahidi is a crisis-mapping tool that makes information instantly available to anyone in the world. T/F
andrezito [222]

Answer: True

Explanation: Ushahidi is technology that is responsible for the dividing the work and gaining the outcomes from the public accounting ,publishing, social activities for the instantly making the information available towards the world.

It is a non-profit organization that is responsible for the distribution of any products to clients for the crisis mapping mechanism and gaining the feedback reports.

4 0
3 years ago
5 efectos del desarrollo tecnológico en el medio ambiente
sineoko [7]

Answer:

english plzzz

Explanation:

5 0
2 years ago
Other questions:
  • Type the correct answer in the box. Spell all words correctly.
    9·1 answer
  • 3. What type of error is in the following sentence? "George W. Bush is the President of the United States of
    5·1 answer
  • Which type of denial of service attack exploits the existence of software flaws to disrupt a service?
    12·1 answer
  • What can use so tha the slides can appear?
    13·1 answer
  • Which part is the author’s address?
    5·1 answer
  • Which of the following is a popular open source intrusion detection system that runs on SmoothWall?? Synchronous Dynamic Random
    6·1 answer
  • Who is hurt by piracy
    10·1 answer
  • What is a fire wall and how does it work
    6·1 answer
  • Expectation on Information Technology Fundamental​
    12·1 answer
  • When can designers use rapid application development?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!