Search This Blog

Monday, December 27, 2010

Define class employee with given data members & member methods - ICSE BOARD QUESTION 2008

/** Define a class employee   ICSE BOARD QUESTION 2008
 */
import java.io.*;
class questionFOUR2008
{
    public static void main(String args[]) throws IOException
    {
        employee ob=new employee();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the PAN NUMBER");
        int pan=Integer.parseInt(br.readLine());
       
        System.out.println("Enter the NAME ");
        String name=br.readLine();
       
        System.out.println("Enter the TAX INCOME");
        double taxincome=Double.parseDouble(br.readLine());
       
       ob.input(pan, name, taxincome);
       ob.calc();
       ob.display();
    }
}
    


class employee  
{
    int pan;
    String name;
    double taxincome;
    double tax;
   
    void input(int p, String n, double ti)
    {
        pan=p;
        name=n;
        taxincome=ti;
    }
    void calc()
    {
        if(taxincome <= 100000)
        {
            tax =0;
        }
        else if(taxincome<=150000)
        {
            tax=(taxincome-100000)*0.10;
        }
        else if(taxincome<=250000)
        {
            tax=5000+(taxincome-150000)*0.20;
        }
       
        else
        {
            tax=25000+(taxincome-250000)*0.30;
        }
    }
    void display()
    {
        System.out.println("PAN NUMBER \t NAME \t TAX-INCOME \t TAX");
        System.out.println("===============================================");
        System.out.println(+pan +"\t" + name +"\t" + taxincome+"\t"+ tax);
    }
}


 OUTPUT:

Enter the PAN NUMBER
123456789
Enter the NAME
AMAN
Enter the TAX INCOME
300000


 
PAN NUMBER      NAME      TAX-INCOME      TAX
===============================================
123456789              AMAN         300000.0             40000.0

6 comments:

  1. Write A Program to input customer name, number of units used then calc. the rate as follows:

    First 100 units - 1.5Rs for each unit
    Next 50 units - 1.25Rs for each unit
    Next 25 units - 1.5p for each unit
    Then 2 Rs for each unit



    Please solve this sum for me. I will forever be in your debt. Please tell if I can ask you more questions.
    You are a great teacher.

    ReplyDelete
  2. Class name: wow
    Data member :static int c(to count the position of the word)
    string str( to store a sentence)
    Member method : wow(): default constructor
    String comput (String word): to accept a word from the sentence and form a new word after letter extraction.
    Void display (string sen): to display the new word and print if it is a wow sentence or not.

    Please solve this program immediately for me.
    Thank you

    ReplyDelete
  3. The ICSE board is one of the most popular boards in India and students who belong to the Icse board are very lucky. Because of the covid crisis, many students have been not concentrated on their studies, and Now they are worried about their exam then don't fear because Ziyyara is here for Helping You.
    Visit On:- icse online tuition
    Phone no - +91-9654271931

    ReplyDelete
  4. Visit scoremaster icse java youtube channel

    ReplyDelete
  5. https://youtube.com/channel/UCYHgR2R2SBuZYmj5k-2wZiA

    ReplyDelete
  6. All ICSE impprtant topics presentwd well

    ReplyDelete