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

In chemistry, the pH of an aqueous solution is a measure of its acidity. A solut

ID: 3544437 • Letter: I

Question

In chemistry, the pH of an aqueous solution is a measure of its acidity.  A solution with a pH of 7 is said to be neutral, a solution with a pH greater than 7 is basic, and a solution with a pH less than 7 is acidic.

A structure is created to store the PH value of a solution.  This structure has two fields:  one is called 'SolutionName', and the other is 'PH'.  An example of such a variable is created as:


sol1 = struct('SolutionName', 'water', 'PH', 7);


Write a function that will take in one such a structure variable as the input argument, determine its acidity, add another field 'acidity; with the determined value to this structure, and return this new structure as the output variable.


For example, if the above sol1 is the input variable, the output variable would be:


OutputVar =

     SolutionName: 'water'

                          PH: 7

                     Acidity: 'neutral'

Explanation / Answer

function argnew = stracidity(arg)

if arg.PH < 7

argnew=arg;

argnew.acidity='Acidic';

else if arg.PH == 7

argnew=arg;

argnew.acidity='Neutral';

else

argnew=arg;

argnew.acidity='Basic';

end

end



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