text: 
  
  
  
  /** Compute Function 
   * @ principal - integer 
   * @ rate - float 
   * @ years - integer 
   * @ interest -  float **/
   function compute()
   {
       var principal = document.getElementById("principal").value;
       var rate = document.getElementById("rate").value;
       var years = document.getElementById("years").value;
       var interest = principal * years * rate /100;
       var year = new Date().getFullYear()+parseInt(years);
       /** Final Text Output Summary **/
       var text = 'If you deposit <span class="result-number">' + principal + '</span>,<br/>'
           text = text + 'at an interest rate of <span class="result-number">' +  rate + '</span>.<br/>'
           text = text + 'You will receive an amount of <span class="result-number">' + interest + '</span>,<br/>'
           text = text + 'in the year <span class="result-number">' + year + '</span>.'
       document.getElementById("result").innerHTML=text
   }
   
   
   /** Updates Rate Value Text
    * @ rate - integer **/
   function updateRate() 
   {
       var rateval = document.getElementById("rate").value;
       document.getElementById("rate_val").innerText=rateval + "%";
   }      
   var form = document.getElementById("calculator");
   function handleForm(event) { event.preventDefault() }
   form.addEventListener('submit', handleForm)
   /** Validate User Input **/
  
   function validate() 
   {
      var form = document.getElementById("calculator");
      function handleForm(event) { event.preventDefault() }
      form.addEventListener('submit', handleForm);
      let x = document.forms["calculator"]["principal"].value;
      if (x == "" || x < 1) {
          alert("Amount is invalid. Please enter a positive Number larger than 0");
          document.getElementById("principal").focus()
          return false;
      }    
      compute()
      return true
  }