Write a program that will read a molecular formula such as


Problem

Write a program that will read a molecular formula such as H2SO4 and will write out the molecular weight of the compound that it represents. Your promolecular weight gram should be able to handle bracketed radicals such as in Al2(SO4)3.

[Hint: Use recursion to find the molecular weight of a bracketed radical. Simplifications: You may find it helpful to enclose the whole formula in parentheses (... ). You will need to set up a hash table of atomic weights of elements, indexed by their abbreviations. For simplicity, the table may be restricted to the more common elements. Some elements have one-letter abbreviations, and some two. For uniformity you may add blanks to the one-letter abbreviations.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that will read a molecular formula such as
Reference No:- TGS02642807

Expected delivery within 24 Hours