Can anyone tell me what is wrong with the following script? It
is not working when I open the browser. Can anyone help?
var income, age, mStatus, nbrOfChildren;
//read in the variables
income = prompt ("Enter income", "0" );
age = prompt("Enter age", "0" );
mStatus = prompt ("Enter marriage status", "0" );
nbrOfChildren = prompt ("Enter number of children", "0" ) ;
//convert from strings to integers
income = parseInt(income);
age = parseInt (age);
mStatus = parseint(mStatus);
nbrOfChildren = parseInt(nbrOfChildren);
A = 0;
B = income*(0.1-0.01*nbrOfChildren);
C = income*(0.07);
D = income*(0.12);
if(income < 20000) {
document.writeln ("Tax is equal to" + zero);
}
else if (age >=85) {
document.writeln ("Tax is equal to" + zero );
}
else if (income >20000 && age < 85 && mStatus
= "Married" && nbrOfChildren <= 3) {
document.writeln ("Tax is equal to" + B );
}
else if (income >20000 && age < 85 && mStatus
= "Married" && nbrOfChildren > 3) {
document.writeln ("Tax is equal to" + C );
}
else {
document.writeln ("Tax is equal to" + D );
}