CalcBuilder Forum

Need Help Building a calculator

User chadely 2016-05-21 16:11:29

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 2016-05-21 16:21:00

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 2016-05-22 12:31:48

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 2016-05-26 15:53:24

Thank You very much.

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!