Question
In chemistry, neutralization occurs when an acid and a base react with each other. Most chemistry occurs in water (that is, is aqueous); under these
In chemistry, neutralization occurs when an acid and a base react with each other. Most chemistry occurs in water (that is, is aqueous); under these circumstances, neutralization leads to water with no excess hydrogen or hydroxide ions present. Neutralization can most simply be expressed as
acid + base salt + water
For example,
HCl + NaOH NaCl + H2O
The stoichiometry of the reaction depends on how much hydrogen ion and hydroxide ion each reactant provides. In this case, each molecule of HCl provides one hydrogen ion, and each molecule of NaOH provides one hydroxide ion. The one hydrogen and one hydroxide ion combine to form one molecule of water.
For this assignment, suppose that you have been presented with several solutions of hydrochloric acid (HCl) and some of the most popular bases for wastewater treatment: magnesium hydroxide (Mg(OH)2), calcium carbonate (CaCO3), calcium oxide (CaO), sodium bicarbonate (NaHCO3), sodium hydroxide (NaOH), and ammonia (NH4OH). The neutralization reactions are as follows:
2HCl + Mg(OH)2 MgCl2 + 2H2O (1 mol of Mg(OH)2 will neutralize 2 mol of HCl)
2HCl + CaCO3 CO2 + CaCl2 + H2O (1 mol of CaCO3 will neutralize 2 mol of HCl)
2HCl + CaO CaCl2 + H2O (1 mol of CaO will neutralize 2 mol of HCl)
HCl + NaHCO3 CO2 + H2O + NaCl (1 mol of NaHCO3 will neutralize 1 mol of HCl)
HCl + NaOH NaCl + H2O (1 mol of NaOH will neutralize 1 mol of HCl)
ASSIGNMENT:
Write a C program that calculates how much base is required to neutralize a solution of hydrochloric acid. For this program, start with a solution that contains 5 mol of HCl, incrementing by 5 mol of HCl, up to a final solution containing 20 mol of HCl. Let the HCl level be controlled by a while loop. Within the while loop, insert a for loop. This for loop should start at 1, increment to 5, and count up by 1. This loop will act as the acid selector. A value of 1 will be Mg(OH)2, a value of 2 will be CaCO3, a value of 3 will be CaO, a value of 4 will be NaHCO3, and a value of 5 will be NaOH. For each of these bases, calculate how much mass is need to neutralize the hydrochloric acid. (Hint: this will likely be easiest to do with embedded if statements). The output should print as a table.
The following constants should be defined in preprocessor directives:
Molar mass of Mg(OH)2 58.32
Molar mass of CaCO3 100.09
Molar mass of CaO 56.08
Molar mass of NaHCO3 84.01
Molar mass of NaOH 40.00
Use the Code Sections.c template on Blackboard to write your code.
Your program output will look like the illustration shown below. Use your PCs cursor to determine the horizontal and vertical spacing for the output format.
OUTPUT FORMAT:
********************************************
NEUTRALIZING HYDROCHLORIC ACID
HCl Level = 5.0 mol
Base Amount needed (g)
Mg(OH)2 xxxx.xx
CaCO3 xxxx.xx
CaO xxxx.xx
NaHCO3 xxxx.xx
NaOH xxxx.xx
HCl Level = 10.0 mol
Base Amount needed (g)
Mg(OH)2 xxxx.xx
CaCO3 xxxx.xx
CaO xxxx.xx
NaHCO3 xxxx.xx
NaOH xxxx.xx
. .
. .
. .
********************************************
A successful program will:
Include a complete header block, including section number, date, program number, name, a thorough program description there are several loops and if statements to describe, and description of variables table
Include molar masses defined in preprocessor directives
Have an outer while loop to control number of moles of HCl
Have an inner for loop to control acid selection
Have nested if statements to determine how many grams of a base are required to neutralize the acid and print the base and mass to the screen
Be properly indented Dev-C++ and xcode will do this for you
Have no formatting issues
Have output that matches that provided by the assignment handout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started