JavaScript Practice Questions And Answer

Problem: Write a program to calculate the income tax of an employee.
The tax slabs according to annual salary are :
upto rs.300000 tax is 0%
from rs.300000 to rs. 500000 tax is 10%
from rs.500000 to rs. 1000000 tax is 15%
more than 100000 tax is 20%
Note: 250000 is exempted from tax criteria
Solution:
            <html>
             <head>
              <script>
                function findTax()
              {
                var salary = 680300
                var taxableSal = salary-250000 //430300
                  if(taxableSal <= 300000)
                {
                  document.writeln("No tax")
                }
                 else
                  {
                   if(taxableSal>300000 && taxableSal<=500000)
                    {
                      var tax = taxableSal * 10/100
                      document.writeln("Tax = "+tax)
                    }
                     else
                      {
                       if(taxableSal>500000 && taxableSal<=1000000)
                        {
                          var tax = taxableSal * 15/100
                          document.writeln("Tax = "+tax)
                        }
                        else
                         {
                          var tax = taxableSal * 20/100
                          document.writeln("Tax = "+tax)
                          }
                      }
                    }
                  }
                  findTax()
              </script>
             </head>
           </html>
          

Contact Us

Our Address

Office no.- 401,Shekhar Central Building ,Palasiya, Pin-code:452001, Indore

Email Us

contact@codebetter.in

Call Us

+91 88230 75444, +91 99939 28766

Loading
Your message has been sent. Thank you!