These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

University Javascript Tax Assignment

Adge
Registered: Apr 1 2008
Posts: 4

Hey guys I have a project I am doing for univeristy that requires me to create a javascript form that requires me to have a table containing values for Income, RRSP, Tax Rate, Taxes Paid and Refund or Due. There are also four radio buttons that are used containing extra deductions and a check box for if your over 65. The following If Statement is used for the income, If the income is greater than or equal to 70000 then taxrate=70%, if the income is greater than or equal to 20000 then taxrate= 10%, else it is 25%. If RRSP has been bought, Income will be reduced by 50% of the RRSP value. If you have a chile 20% is taken off the tax rate, if spouse it is 30%, and if both it is 50% and if none it stays the same. Lastly if you check 65 or older then the tax rate is cut by half after the extra decuctions have been made. So basically I have the entire layout done on this but I can't get any of the calculations or functions to work. If anybody can fix my javascript to work or can help me out in any way it would me much appreciated. Here's my code so far:

function calc(){

var FirstNumber = parseInt(Form1.FirstNumber.value);
var ThirdNumber = parseInt(Form1.ThirdNumber.value);

if (FirstNumber>=70000){ThirdNumber = 70}
else if(FirstNumber <=20000){ThirdNumber = 10}
else {ThirdNumber = 25}
}
{
var rrsp,income;
rrsp= parseInt(Form1.SecondNumber.value);

if (SecondNumber>0)
{
income = (income)-(rrsp*.5);
}
else
income = (income)-(rrsp)
}
Form1.FirstNumber.value=income

{
var income,
taxrate,
taxespaid,
refund;

income = parseInt(Form1.FirstNumber.value);
taxrate = parseInt(Form1.ThirdNumber.value);
taxespaid = parseInt(Form1.FifthNumber.value);

refund= income*taxrate-taxespaid
Form1.refund.value=refund;
}
{
var number1,
number2,
sum;

number1 = parseInt(form1.FirstNumber.value);
number2 = parseInt(form1.SecondNumber.value);

sum = number1 + number2;
document.form1.answer.value = sum;
}

{
var count = 0;
var stars;
stars = parseInt(Form1.taxrate.value);
document.Form1.display.value = Form1.display.value + "\n";
for (var count = 1; count <= stars; count = count + 1)
{
Form1.display.value = Form1.display.value + "*" ;
}
}

.style1 {
text-align: left;
}
.style3 {
text-decoration: underline;
font-family: "Arial Black";
font-size: large;
color: #009999;
}
.style4 {
text-align: center;
}

The Taxman

Your Tax Information

var theone

Income
RRSP
Tax Rate
Taxes Paid
Refund or Due

Extra Deductions -
Children
Spouse
Both
None

Over Age 65?

Special Cases  
Normal
Hardship Claimed
Mercy
Lawyer

   
 
  

Your Tax Rate

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
This is a forum for Acrobat JavaScript used in Acrobat or LiveCycle Designer forms, not web page Java.

George Kaiser

Adge
Registered: Apr 1 2008
Posts: 4
sorry bout that, i'll try another forum then