ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2008 ICSE Computer Science Paper



Share with a Friend

Solved 2008 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Tax Computation Program - ICSE 2008 Computer Science

Define a class Employee having the following description:
Data members/instance variables:
int pan: to store personal account number.
String name: to store name.
double taxIncome: to store annual taxable income.
double tax: to store tax that is calculated.
Member functions:
input(): store the pan number, name, taxable income.
calc(): calculate tax for an employee.
display(): output details of an employee.
Write a program to compute the tax according to the given conditions and display the output as per given format.

Total Annual Taxable IncomeTax Rate
Up to Rs. 1,00,000No tax
From 1,00,001 to 1,50,00010% of the income exceeding Rs. 1,00,000
From 1,50,001 to 2,50,000Rs. 5000 + 20% of the income exceeding Rs. 1,50,000
Above Rs. 2,50,000Rs. 25,000 + 30% of the income exceeding Rs. 2,50,000.

Output:

Pan Number        Name        Tax-income        Tax
- - - -
- - - -
- - - -
- - - -
import java.util.Scanner; class Employee{ int pan; String name; double taxIncome; double tax; public void input(){ Scanner in = new Scanner(System.in); System.out.print("PAN Number: "); pan = Integer.parseInt(in.nextLine()); System.out.print("Name: "); name = in.nextLine(); System.out.print("Taxable income: "); taxIncome = Integer.parseInt(in.nextLine()); } public void calc(){ if(taxIncome <= 100000) tax = 0.0; else if(taxIncome <= 150000) tax = 0.1 * (taxIncome - 100000); else if(taxIncome <= 250000) tax = 5000 + 0.2 * (taxIncome - 150000); else tax = 25000 + 0.3 * (taxIncome - 250000); } public void display(){ System.out.println("PAN\tName\tIncome\tTax"); System.out.println(pan + "\t" + name + "\t" + taxIncome + "\t" + tax); } public static void main(String args[]){ Employee obj = new Employee(); obj.input(); obj.calc(); obj.display(); } }

Output

 
 OUTPUT  : 
PAN Number: 123456
Name: Rishi
Taxable income: 1650000

PAN         Name    Income       Tax
123456    Rishi     1650000.0     445000.0