# Zoho Creator: Build an online calculator tutorial. #1: Preparation

A good preparation is half the work!

When building apps, it is important to have at least a little think about what it’s going to look like. The calculator I want to build is a calculator that can calculate the molecular weight of a molecule. For this, the user needs to fill in the chemical formula. I also want it to show a breakdown of the different elements in that molecule and their weight in that molecule, in molar mass and percentage. As an extra, I want the user to be able to fill in a weight of the substance, so that the calculator can also calculate the actual weight of each element in that substance. For instance, if someone has one kg of water (H2O), the user will see how many kg’s of H and O are present in that kg of water.

## Elements in the calculator

There are multiple ways to get this done, but the easiest way is to create one form for the user to use to calculate the molecular weight, and another form in which to store the background data:

• The background data will consist of the data needed to calculate: the symbols and atomic mass of the elements.
• The user form needs two input fields (for the chemical formula and the substance weight), a subform to show the results per element, and a field to show the molecular weight of the molecule.

## What does the calculator need to do in the backend?

A chemical formula can consist of:

• Letters, representing the elements, grouped in sets of one, two, or three, starting with a capital letter.
• Parentheses, signifying a chemical group within the molecule.
• A dot to start a hydration group.
• Numbers, multiplying the element, chemical group in parenthesis or the hydration group.

For the program to convert the user input (the chemical formula) into a molecular weight, it needs to be able to:

1. Identify the elements present in the molecule.
2. Recognise what the parentheses mean.
3. Recognise what the dot means.
4. Recognise what the numbers mean.
5. Use all of the above to count the elements.
6. Multiply the found elements with the atomic mass of those elements.

Most of this will be done with Deluge code. Only storing the data of the elements will be done in a separate form, so that we can use Deluge to fetch the needed data when calculating.