Going Further on Programming Assignment 7
This question/problem/task allows you to go further on
Programming Assignment 7. It is neither
required nor for extra credit. It will, however, help you gain a
deeper understanding of the material.
1 Molar Concentration:
The
molarity (or molar concentration) is defined as:
\(c = \frac{n}{V}\)
\(c\) is the
concentration of the solution in mol/L, \(V\) is the volume
of the solution in L, and \(n\) is the amount of the
solute in mol.
For example, suppose we dissolve 15.0g of NaOH and create 225mL of
solution. The molarity (or molar concentration) of the solution is
given by:
\(c = \frac{15.0\text{g} \cdot \frac{1\text{mol}}{40.0\text{g}}}
{0.225\text{L}} = 1.67 \text{mol/L}\)
where \(\frac{1\text{mol}}{40.0\text{g}}\) is the
mol/g for NaOH.
2 Tasks:
Either in another class, or in one of the existing classes,
implement one or more methods that can be used to calculate
any of \(c\), \(n\) or \(v\)
from the other two. (Note: You should spend a considerable amount
of time thinking about which classes the methods should belong to
and whether they should be static or not.)