# Conditional variable quandary

Hi folks

A friend was asked to create a calculator which adds several variables together and produces an output which has other pre-determined variables added or subtracted…

The code for the above, which works fine, is as follows:[INDENT][FONT=Courier New]stop();
function onCalculate() {

seventeen = Number(number_seventeen);
eighteen = Number(number_eighteen);
nineteen = Number(number_nineteen);
twenty = Number(number_twenty);
twentyone = Number(number_twentyone);
twentytwo = Number(number_twentytwo);
result_amount = seventeen + eighteen + nineteen + twenty + twentyone + twentytwo;
assets_liabilities = result_sum - result_amount;
net_estate = assets_liabilities - nil_rateband;
tax_liability = 40 / 100 * net_estate
}[/FONT]

[/INDENT]The problem now is that the people that asked for it forgot to say they needed a further calculation which between us we just can’t work out!

Basically, if [FONT=Courier New]net_estate[/FONT] is under 285000, then [FONT=Courier New]tax_liability[/FONT] is to be 0. but if it’s *over *285000 then [FONT=Courier New]tax_liability = 40 / 100 * net_estate [/FONT][FONT=Verdana](as in the above code).[/FONT]