Okay, so I am trying to build a stoichiometry calculator. I really want it to have built in molar masses to simplify things for the user. I am using a class to do this and as far as I can tell it works well enough. Now when a user types in "grams to mols", equation will then equal grams to mols, and then that block will execute. When the user is asked for a compound, compound is the variable I use. How would I get it so that compound.molarmass will pull the appropriate variable from the Element class. The only sure fire way I know of would be if/elses, but I want to add a lot of compounds so that's out of the question for me.