Page 274 - CA_Blue( J )_Class10
P. 274

Define a class Employee having the following description:
                Program 3
                              Data Members
                              String pan                 :       to store Permanent account number
                              String name                :       to store name
                              double tax_income          :       to store annual taxable income
                              double tax                 :       to store tax that is calculated
                              Member functions
                              void input ( )             :       Store the pan number, name, taxable income
                              void calc( )               :       Calculate tax for an employee
                              void display ( )           :       Output details of an employee
                              Write a program to compute the tax according to the given conditions and display the output as
                              per the given format.
                              Annual Taxable Income              Tax Rate
                              Upto Rs. 1,00,000          :       No tax
                              Rs.1,00,001 to Rs.1,50,000    :    10% of the income exceeding Rs.1,00,000
                              Rs.1,50,001 to Rs.2,50,000    :    5000+20% of the income exceeding Rs.1,50,000
                              Above Rs. 2,50,000         :       25,000+30% of the income exceeding Rs.2,50,000
                              Output:      Pan Number            Name          Tax-income            Tax
                                           __                    __            __                    __

                 1  import java.util.*;
                 2  class Employee

                 3  {
                 4      String pan, name;

                 5      double tax_income,tax;

                 6      void input()
                 7      {
                 8         Scanner sc=new Scanner(System.in);

                 9         System.out.print("Enter your PAN no.: ");
                10         pan=sc.next();

                11         System.out.print("Enter your name: ");

                12         name=sc.next();
                13         System.out.print("Enter taxable income: ");

                14         tax_income=sc.nextDouble();
                15     }
                16      void calc()

                17      {

                18         if(tax_income<=100000)
                19         tax=0;
                20         else if(tax_income<=150000)



                272272  Touchpad Computer Applications-X
   269   270   271   272   273   274   275   276   277   278   279