mardi 16 février 2016

JavaScript - If Statement Math [on hold]

var income = 79000; //this holds the income user enters at prompt.
var bracket1 = 0.15; //tax bracket 1.
var bracket2 = 0.25; //tax bracket 2.
var maxIncome0 = 10000; //this is the max income not taxable.
var maxIncome1 = 36000; //max income level for tax bracket 1.
var maxIncome2 = 90000; //max incmoe level for tax bracket 2.

//prompts user to input income.
//income = Number(prompt("Enter you income here"));

if (income > maxIncome2) {
document.write("I do not have the data to calculate the tax on this income");
}

else if (income > maxIncome1) {
taxes = ((income - maxIncome0) * bracket2) + (income - maxIncome1 - maxIncome0) * bracket1;
document.write(taxes);
}

Aucun commentaire:

Enregistrer un commentaire