Tank volume

Calculator computes tank volume given its length, diameter and walls depth. Created by user's request.

One of users asks for a calculator, which can compute tank volume given its length, diameter and walls depth. Here it is.

PLANETCALC, Tank volume

Tank volume

Digits after the decimal point: 3
Used volume in cubic meters
 
Walls volume in cubic meters
 
Total volume in cubic meters
 



Since it is quite simple, I decided to use it as example and eventually write

Step-by-step guide: How to create online calculator

cause this site is GUI and engine for online calculators, that is - calculators authoring tool.
There are only two prerequisites for author: first, he should be registered user, second, he should be able to code what he wants to compute in Javascript.

Step 1

Go to "My calculators" page and choose "Create new..." -> "Calculator". This will open calculator editor.

step1.JPG

Step 2

First, fill "Name" and "Description" fields. Description is used in lists.

step2.JPG

Step 3

Now, we should add input parameters, which are (in our case) length, diameter and walls depth. Toolbar is used for adding and removing various calculators parameters, but now we need only simple input parameters. Press the button with "in" mark. This will open parameter editor dialog. Fill it like on the picture below. Note that "Variable" field is the name of the variable, which then will be available in Javascript. I hope that other fields are self-descriptive.

step3.JPG

Step 4

Repeat the same for the "diameter" parameter

step4.JPG

Step 5

And for the "depth" parameter

step5.JPG

Step 6

Now we should add simple output parameters. In our case these are used volume, total volume and walls volume. Press the button with "out" mark. This will open parameter editor dialog.

step6.JPG

Step 7

Fill dialog for the "used" parameter like on the picture below.

step7.JPG

Step 8

Repeat the same for the "walls" parameter

step8.JPG

Step 9

And for the "total" parameter

step9.JPG

Step 10

Now, when all ins and outs are in place, we can start coding. Those who knows Javascript should have no problem with the code on the picture below except one thing - how output parameters are handled. You can't just assign computed values to them, that won't do the trick. You have to use special method SetValue and pass computed value as parameter of this method. These are last three lines of code. Except that it is plain Javascript.

step10.JPG

Step 11

Now you can fill in some tags for better classification and press "Preview" button

step11.JPG

Step 12

On preview page you can check how it is working and return to editing or decide to publish it. If later, press "Publish" button

step12.JPG

Step 13

After publishing, calculator receives unique URL.

step13.JPG

Step 14

Now, each calculator, like this one, needs couple of words for other visitors like why it is done and how to use it, etc. This is done with article. Note that it is not a calculators, it is articles, which are listed on site. So, choose "Create new..." -> "Article" and this will open article editor.

step14.JPG

Step 15

In article editor, write couple of words about calculator, and press first toolbar button to insert calculator into article

step15.JPG

Step 16

Locate and choose your newly created calculator

step16.JPG

Step 17

It will be pasted into article text with brackets.

step17.JPG

Step 18

Press "Save". On save page you can preview your article and decide that it is ready for publishing. Article publishing assigns unique URL to the article and lists it on site navigation.

The end.

Ссылка скопирована в буфер обмена
PLANETCALC, Tank volume

Комментарии