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
Create a Python program in a file named loops1.py that does the following: a. Use a while loop to keep asking the user for input
Rashid [163]

Answer:

mystr = input("Enter a string ")

length = len(mystr)

while length<10:

   mystr = input("Enter a string ")

   length = len(mystr)

   if(length>=10):

       break

if len(mystr)%2==0:

   print(mystr.lower())

else:

   print(mystr.upper())

Explanation:

The variable mystr is used to save user's input which is received with the input function

A second variable length is used to save the length of the input string Using a while statement the user is continually prompted to enter a string while length is less than 10.

If length is greater or equal to 10. We check for even or odd using the modulo (%) operator.

We use lower() and upper() to change the case of the string

7 0
2 years ago
Read 2 more answers
The definition of network is:
kondaur [170]

\text{Hello there!}

<u>Networks were originally used as a government weapon 61 years ago</u> to <u>communicate information</u> such as data and research. However, individual networks were eventually discontinued by the government and made open to the public to use for things such as PAN, LAN, MAN, WAN, SAN, and so on.

<u>Our internet today is capable of communicating with bilions of computers.</u> This is possible due to your modem using radio wave-like speeds to connect to your ISP. Your ISP then connects to a larger network, which is connecting to thousands of other networks. You see, <u>the internet is just a large network of networks that are connected through very fast radiowaves</u>. However, it is not just a single network being used anymore; it's thousands of them. The term, "internet" was used to describe this large selection of networks. In short, <u>B</u><u> would be incorrect. </u>

The worldwide web is a protocol used by the internet to connect to select websites favourably from whoever's using it. This obviously would not define the network, as this is something that's used by it. Furthermore, <u>A</u><u> would not be correct.</u>

As described already, the network was a selection of computers used to communicate information to each other. <u>C </u><u>would not be correct </u>as it states that there is only one computer being used.

\fbox{Therefore, D would be the correct answer.}

\rule{300}{1.5}

6 0
2 years ago
Question 1 of 40
Novay_Z [31]

Answer:

D. Federal Work-Study

Explanation:

8 0
3 years ago
What happens when the programmer tries to access an array cell whose index is greater than or equal to its logical size?
just olya [345]

Answer:

When a programmer tries to access an item in an array cell whose index is greater than or equal to the array's logical size, this data element or item is garbage. This means that currently, the item is not the part of the program's useful data. Garbage contains objects or data which will not be used by a program running on it. So the value returned could be either of the two:

  • Value would be an arbitrary or random number if it is an array of numbers. Arbitrary means that the value is not predefined or specified in advance.
  • Value returned would be null if it is an array of objects.

                                                           

 

3 0
3 years ago
What port number is the well-known port used by web servers to distribute web pages to web browsers?question 3 options:?
stira [4]
This is port 80 for clear-text connections and 443 for encrypted (TLS) connections.
5 0
2 years ago
Other questions:
  • What are examples of educational obstacles to a career plan?
    13·1 answer
  • Which device on a network performs network address translation?
    8·1 answer
  • Which system tool allows you to manage the available space on your hard disk to improve efficiency? A. ScanDisk B. Anti-Virus C.
    10·1 answer
  • What lets you do many things, like write book reports and stories?
    15·1 answer
  • Are storage devices input devices
    8·1 answer
  • The picture that graphically represents the items you use in Windows is called a/an <br> ___?
    14·1 answer
  • Write a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, y
    14·1 answer
  • Identify the hardware components in your own computer. If you don't have a computer, use a friend's, or one at work or in an NVC
    5·1 answer
  • Your friends are having difficulties with their computer setups. Can you suggest a way to help each friend?
    5·1 answer
  • Shandra recently bought a brand-new digital camera from a local camera shop but when she got it home, she noticed the lens was j
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!