Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem I: The pH of an aqueous solution is a measure of its acidity. The pH sca

ID: 3590050 • Letter: P

Question

Problem I: The pH of an aqueous solution is a measure of its acidity. The pH scale ranges from 0 to 14, inclusive. A solution with a pH of 7 is neutral, a solution with a pH less than 7 is acidic and a solution with a pH greater than 7 is basic. Create a script file that will prompt the user to input the pH of a solution. First check to see if the pH is invalid (outside the range of 0 to 14 inclusive). If it is invalid, generate an error message. An error message can be created with the following line of code: error( 'Your pH is not in the proper range"). If the pH is valid then determine if the solution is acidic, basic, or neutral. Add fprintf statement(s) to display to the user the pH that was entered and whether the solution is acidic, neutral, or basic. Test your code using by creating 4 test cases to cover the four possible outputs (acidic, basic, neutral, and out of range). Fill in the table below with your 4 test cases. pH Script Output in Command Window from fprintf statement Entered? Test Case #1 Test Case #2 Test Case #3 Test Case #4 Paste your Script file commands here:

Explanation / Answer

clear all, clc

pH = input('Enter pH value: ');

if (pH<0 || pH>14)
fprintf('Your pH is not in the proper range.');
elseif (0 <= pH < 7)
fprintf('Solution is Acidic.');
elseif (7 < pH <= 14)
fprintf('Slution is Basic.');

elseif (pH==7)
fprintf('Solution is Neutral.');

else
fprintf('Error');

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote