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
pychu [463]
3 years ago
6

Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variabl

es neutral, base, and acid: a. false, false, true if pH is less than 7 b. false, true, false if pH is greater than 7 c. true, false, false if pH is equal to 7.
Computers and Technology
1 answer:
Volgvan3 years ago
6 0

Answer

       if (pH<7.0){

           neutral=false;

           base=false;

           acid=true;

       }

       else if (pH>7.0){

           neutral=false;

           base=true;

           acid=false;

       }

       else if (pH==7.0){

           neutral=true;

           base=false;

           acid=false;

       }

A complete java program that prompts a user for the pH value is provided in the explanation section

Explanation:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

      Scanner in = new Scanner(System.in);

       System.out.println("Enter a value for the pH");

       boolean neutral, base, acid;

       double pH = in.nextDouble();

       if (pH<7.0){

           neutral=false;

           base=false;

           acid=true;

       }

       else if (pH>7.0){

           neutral=false;

           base=true;

           acid=false;

       }

       else if (pH==7.0){

           neutral=true;

           base=false;

           acid=false;

       }

}

}

You might be interested in
Jacek has just started a new job as a sales clerk, and his first task is to create a new sales invoice. Which Microsoft software
g100num [7]

Answer:

Microsoft Excel

Explanation:

Microsoft Excel is a Microsoft application package. It is a spreadsheet application used to analyse and manipulate data. It has columns which are referred to fields and rows also known as records.There are various features in excel that used to create statistical and graphical esctasies and data presentations.

It can be used to create template for CVs/resumes, Bank draft, receipts and invoice etc.

5 0
3 years ago
Implement a sublinear running time complexity recursive function in Java public static long exponentiation (long x, int n) to ca
Archy [21]

Answer:

Following are the code block in the Java Programming Language.

//define recursive function

public static long exponentiation(long x, int n) {

//check the integer variable is equal to the 0.

if (x == 0) {

//then, return 1

return 1;

}

//Otherwise, set else

else {

//set long data type variable

long q = exponentiation(x, n/2);

q *= q;

//check if the remainder is 1

if (n % 2 == 1) {

q *= x;

}

//return the variable

return q;

}

}

Explanation:

<u>Following are the description of the code block</u>.

  • Firstly, we define the long data type recursive function.
  • Then, set the if conditional statement and return the value 1.
  • Otherwise, set the long data type variable 'q' that sore the output of the recursive function.
  • Set the if conditional statement and check that the remainder is 1 and return the variable 'q'.
8 0
3 years ago
5 características de la obsolescencia programada...
snow_lady [41]

Answer:

Obsolescencia programada es cuando un producto está diseñado deliberadamente para tener un tiempo de vida específico. ... Los productos dejan de funcionar al cabo de un tiempo, no porque estén estropeados, sino por que han sido diseñados para fallar al cabo de ese periodo.

Explanation:

espero y esto te pueda ayudar

4 0
3 years ago
Where should citations be included in your research paper? Select all that apply.
yKpoI14uk [10]

Answer:

it would be the first one because it's the header and that's what applies

5 0
3 years ago
Borrowing other images and videos are allowed as long as ________?​
My name is Ann [436]

Answer:

as long as there appropriate

6 0
2 years ago
Other questions:
  • Write a Python program to do the following:
    12·1 answer
  • Which of the following statements is false? a. A class can directly inherit from class Object. b. If the class you're inheriting
    14·1 answer
  • "As part of integrating your solution your client indicates that they have certain technologies enabled on their network that al
    6·1 answer
  • FS and GS are two___________________ in protected mode.
    14·1 answer
  • What is the binary system?
    13·2 answers
  • Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, follow
    9·1 answer
  • Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s s
    9·2 answers
  • Who watches Riverdale ? if you do can we be friends(pLEASE DON'T DELETE) and also who is your fav character from Riverdale
    8·2 answers
  • How can I use HTML to express a personal value
    13·1 answer
  • During boom times, which of the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!