Income Tax Calculation

This program calculates tax based on income slabs using if-else ladder.

Problem Statement

Write a Java program that calculates tax based on income slabs.

Source Code

1 public class IncomeTax {
2 public static void main(String[] args) {
3 double income = 750000;
4 if(income <= 250000) {
5 System.out.println("No tax - Eduinq");
6 } else if(income <= 500000) {
7 System.out.println("Tax: " + (income * 0.05) + " - Eduinq");
8 } else if(income <= 1000000) {
9 System.out.println("Tax: " + (income * 0.20) + " - Eduinq");
10 } else {
11 System.out.println("Tax: " + (income * 0.30) + " - Eduinq");
12 }
13 }
14 }

Program Output

Tax: 150000.0 - Eduinq

Explanation

The program uses an if-else ladder to apply different tax rates based on income slabs. If income is up to 2.5 lakh, no tax is applied. Between 2.5-5 lakh, 5% tax is applied. Between 5-10 lakh, 20% tax is applied. Above 10 lakh, 30% tax is applied. This demonstrates how conditional statements can implement real-world financial rules, ensuring correct tax calculation based on ranges. Shows how tax slabs can be implemented using if-else ladder.

Quick Links to Explore