Question: Programming Problem Chemists, biologists, and biochemists, are often interested in calculating the pH level of a given solution. A solution with a pH level less


Programming Problem Chemists, biologists, and biochemists, are often interested in calculating the pH level of a given solution. A solution with a pH level less than 7 is acidic, otherwise, it is basic. Determining the pH of a solution is important, since many organisms and micro-organisms can only live in a limited pH range. Instructions: . Start a C++ program from scratch to solve the above problem. Request an input for a concentration of hydroxide ions, denoted OH, and represented as a real number (you decide the appropriate type). Calculate the concentration of hydronium ions, abbreviated H, using this formula: H+= 10-14 / OH Calculate the pH level from the hydronium concentration with this formula: pH = - log (H) For example, if the input solution is 0.002 OH your program should print something like this: The pH level of solution 0.002 is 11.3010299957. The solution is basic. Use proper loops and selection control structures - void use of continue and early return. Use meaningful variable names, proper indentation, and appropriate comments. Use the output format and style shown in the sample run below. Here are four hydroxide concentrations to use as test input: 0.002 ( or 2.8e-3) 0.00006 ( or 6.0-5) 0.000000007 ( or 7.0e-9) 0.0000000009 ( or 9.Be-10) Show your lab instructor that your program works. Tips: You may find the following will help you with the formulas: This program requires you to use log base 10 - and the log() function doesn't do that in C++. There are several log functions in the cmath library. - be sure to choose the right one. C++ allows you to initialize and print values in scientific notation like this: double avogadro = 6.622e+23; // Avogadro's Number If you find that confusing, you can also use the pow() function from cmath. double avogadro = 6.622* pow(10.6,23.0); // Avogadro's Number Activate Windows If you find that confusing, you can also use the pow() function from cmath. double avogadro = 6.022* pow(10.0,23.0); // Avogadro's Number Sample Output This program calculates ph level Enter to quit the program. Please input the concentration of hydroxide: 0.002 The ph level of solution 0.0020000000 is 11.3010299957. The solution is basic. Please input the concentration of hydroxide: 0.00006 The ph level of solution 0.0000600000 is 9.7781512504. The solution is basic. Please input the concentration of hydroxide: 0.000000007 The ph level of solution 0.0000000070 is 5.8450988400. The solution is acidic. Please input the concentration of hydroxide: 0.0000000009 The ph level of solution 0.0000000009 is 4.9542425094. The solution is acidic. Please input the concentration of hydroxide: You entered , so quit the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
