Skip to main content
CalcBuilder logo
CalcBuilder Forum

Need Help Building a calculator

User chadely

This is my first experience with this component and the only coding experience i have was in Visual Basic I am building a Fair Price calculator for a contracting company website

So we have 4 inputs
Material cost (Var1)
Labor Cost (Var2)
Debris Removal (Var3)
Permits and Fees (Var4)

I need to add the 4 variables
$sum=$Var1+$Var2+$Var3+$var4;

then multiply the sum by .5
$result=$sum*.5;

Then add the 2 to get the Fair Price
$fairprice =$sum+$result;

so is this correct?
$sum=$Var1+$Var2+$Var3+$var4$result=$sum*.5; $fair price =$sum+$result;

Thank you for any help.

Edited by chadely - 21.05.2016 16:21

User chadely

Well I guess i could Just do this as well and save a step

$sum=$Var1+$Var2+$Var3+$var4$result=$sum*1.5

Moonsoft support

Hi,
yes, you could do it even in a single line:

$result=($Var1+$Var2+$Var3+$var4)*1.5;

you only need to check your variable names (they must match exactly the ones configured at 'fields' tab, also we suggest to start the var names with a lowercase letter), and remember to end each line always with a ;

All math operators are available, and also many advanced functions (log, pow...etc), please let us know if you need further help with any expression.

Then you can print your result at the exit layout using ##result##

Regards

User chadely

Thank You very much.

...
CalcBuilder

Create dynamic calculators

Buy now!
...
List Manager

Build different lists for your site

Buy now!