KnowledgeBoat Logo

Computer Applications

Given below is a hypothetical table showing rate of income tax for an India citizen, who is below or up to 60 years.

Taxable income (TI) in ₹Income Tax in ₹
Up to ₹ 2,50,000Nil
More than ₹ 2,50,000 and less than or equal to ₹ 5,00,000(TI - 1,60,000) * 10%
More than ₹ 5,00,000 and less than or equal to ₹ 10,00,000(TI - 5,00,000) * 20% + 34,000
More than ₹ 10,00,000(TI - 10,00,000) * 30% + 94,000

Write a program to input the name, age and taxable income of a person. If the age is more than 60 years then display the message "Wrong Category". If the age is less than or equal to 60 years then compute and display the income tax payable along with the name of tax payer, as per the table given above.

Java

Java Conditional Stmts

115 Likes

Answer

import java.util.Scanner;

public class KboatIncomeTax
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter Name: ");
        String name = in.nextLine();
        System.out.print("Enter age: ");
        int age = in.nextInt();
        System.out.print("Enter taxable income: ");
        double ti = in.nextDouble();
        double tax = 0.0;

        if (age > 60) {
            System.out.print("Wrong Category");
        }
        else {
            if (ti <= 250000)
                tax = 0;
            else if (ti <= 500000)
                tax = (ti - 160000) * 10 / 100;
            else if (ti <= 1000000)
                tax = 34000 + ((ti - 500000) * 20 / 100);
            else
                tax = 94000 + ((ti - 1000000) * 30 / 100);
        }
        
        System.out.println("Name: " + name);
        System.out.println("Tax Payable: " + tax);
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of Given below is a hypothetical table showing rate of income tax for an India citizen, who is below or up to 60 years. Write a program to input the name, age and taxable income of a person. If the age is more than 60 years then display the message "Wrong Category". If the age is less than or equal to 60 years then compute and display the income tax payable along with the name of tax payer, as per the table given above.

Answered By

51 Likes


Related Questions