Return To CS 110 Home

Colour Theme   Font Size Options
 
   
   
   
Exercise 4

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:

Tips:

You may find the following will help you with the formulas:

Sample Output

   
This program calculates ph level Enter 0 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.8450980400. 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: 0 You entered 0, so quit the program.

When you are done: