For a Chemical Equation Balancer App (Android), how do I count the number of atoms of each element in each term?
Posted
by
Upas
on Stack Overflow
See other posts from Stack Overflow
or by Upas
Published on 2010-12-28T00:39:01Z
Indexed on
2010/12/28
18:53 UTC
Read the original article
Hit count: 171
This is my app: If someone enters "C6H12O6+O2=CO2+H2O", then I have already written code to split the equation into terms, so in an ArrayList called rterms I have the strings: C6H12O6 CO2 and in another ArrayList called pterms, I have: CO2 H2O
I need to count the number of C's in each term of the reactants, so 6 for term 1, 0 for term 2, and then the H's and then O's. How would I do this? Any help is appreciated.
© Stack Overflow or respective owner