function readInput(){
    var FS = document.getElementById(“filingStatus”).value;
    let age1 = Number(document.getElementById(“below5”).value);
    let age2 = Number(document.getElementById(“between6and17”).value);
    let income = Number(document.getElementById(“package”).value);
    //Loading data into variables FS, age1, age2 and income we fill on webpage
    if(age1then 2*50 => x=100
            let child1 = (Math.max((a1*(1600-x)),0)) + (a1*2000);
            //Here max function makes total amount 0 when phaseout amount exceeds 1600
            let child2 = (Math.max((a2*(1000-x)),0)) + (a2*2000);
            total = child1 + child2;
   document.getElementById(‘display’).innerHTML = total;
        }
        else {
         let x = (Math.ceil((i-max2)/1000))*50;
            let child1 = Math.max((a1*(2000-x)),0);
            let child2 = Math.max((a2*(2000-x)),0);
            total = child1 + child2;
   document.getElementById(‘display’).innerHTML = total;
        }
}

.alignCenter {
text-align: center;
}

Filing Status:

Select Filing Status
Single/Married Filing Separately
    Head of Household
    Married Filing Jointly

Enter Number of Children below age 5:

Enter Number of Children between age 6-17:

Enter Income:

Total: