Page 178 - CA_Blue( J )_Class9
P. 178

You will get the following output: 1                   You will get the following output: 2


















                                                                                        21 st
                   Some More Programs                                                 Century   #Coding & Computational Thinking
                                                                                        Skills

                   Program 1      Write a program to input the monthly taxable income and compute the tax according to the
                                  given conditions and display the output.
                                   Total Annual Taxable Income   Tax Rate
                                   Up to Rs. 1,00,000            No tax
                                   From 1,00,001 to 1,50,000     10% of the income exceeding Rs. 1,00,000
                                   From 1,50,001 to 2,50,000     Rs. 5000 + 20% of the income exceeding Rs. 1,50,000
                                   Above Rs. 2,50,000            Rs. 25,000 + 30% of the income exceeding Rs. 2,50,000.

                     1     import java.util.*;
                     2     class tax_calc

                     3     {
                     4         public static void main()

                     5         {
                     6           Scanner sc= new Scanner(System.in);

                     7           double mtaxinc, ytaxinc=0.0, inctax=0.0;
                     8           System.out.print("Enter Monthly Taxable Income: ");
                     9            mtaxinc = sc.nextDouble();

                    10            ytaxinc = mtaxinc*12;

                    11             if(ytaxinc <= 100000)
                    12                 inctax = 0.0;
                    13              else if(ytaxinc <= 150000)

                    14                 inctax = 10.0 / 100.0 * (ytaxinc - 100000);
                    15             else if(ytaxinc <= 250000)

                    16                  inctax = 5000.0 + 20.0 / 100.0 * (ytaxinc - 150000.0);
                    17             else

                    18                    inctax = 25000.0 + 30.0 / 100.0 * (ytaxinc - 250000.0);




                   176    Touchpad Computer Applications-IX
   173   174   175   176   177   178   179   180   181   182   183