ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2012 ICSE Computer Science Paper



Share with a Friend

Solved 2012 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Income Tax Calculation Program - ICSE 2012 Computer Science

Given below is a hypothetical table showing rates of income tax for male citizens below the age of 65 years:

Taxable Income (TI) in RsIncome Tax in Rs
Does not exceed Rs. 1,60,000NIL
Is greater than Rs. 1,60,000 and less than or equal to Rs. 5,00,000.(TI – 1,60,000) x 10%
Is greater than Rs. 5,00,000 and less than or equal to Rs. 8,00,000[(TI – 5,00,000) x 20%] + 34,000
Is greater than Rs. 8,00,000[(TI – 8,00,000) x 30%] + 94,000

Write a program to input the age, gender (male or female) and Taxable Income of a person.
If the age is more than 65 years or the gender is female, display “wrong category”.
If the age is less than or equal to 65 years and the gender is male, compute and display the income tax payable as per the table given above.

import java.util.Scanner; class Tax{ public static void main(String args[]){ Scanner in = new Scanner(System.in); System.out.print("Age: "); int age = Integer.parseInt(in.nextLine()); System.out.print("Gender: "); char gender = in.nextLine().charAt(0); System.out.print("Taxable income: "); double i = Double.parseDouble(in.nextLine()); if(age > 65 || (gender != 'm' && gender != 'M')){ System.out.println("Wrong category!"); return; } double t = 0.0; if(i <= 160000) t = 0.0; else if(i <= 500000) t = (i - 160000) * 0.1; else if(i <= 800000) t = (i - 500000) * 0.2 + 34000; else t = (i - 800000) * 0.3 + 94000; System.out.println("Income tax: Rs. " + t); } }

Output

 
 OUTPUT 1: 
Age: 55
Gender: male
Taxable income: 200000
Income tax: Rs. 4000.0 

 OUTPUT 2: 
Age: 67
Gender: female
Taxable income: 2100000
Wrong category!