Respuesta :
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
import java.util.Scanner;
public class pHTest {
public static void main(String[] args) {
Scanner scr = new Scanner(System.in);
System.out.println("Enter a value for the pH");
int neutral, base, acid;
double pH = scr.nextDouble();
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;
}
} }