You are on page 1of 4

COMPUTER SCIENCE

PROJECT

-ADITI SINGH
-11-B
-25419

Question: Develop a console-based application using Java to calculate taxable income (only direct
tax).
Algorithm:

CREATE class Income

CREATE method main()

READ name

DECLARE tax = 0.0

DECLARE ti

READ income

IF(ti<=200000)

COMPUTE tax=0;

ELSE IF(ti<=300000)

COMPUTE tax=0.1*(ti-200000);

ELSE IF (ti<=500000)

COMPUTE tax=(0.2*(ti-300000))+(0.1*100000);

ELSE IF (ti<=1000000)

COMPUTE tax=(0.3*(ti-500000))+(0.2*200000)+(0.1*100000);

ELSE

COMPUTE tax=(0.4*(ti-1000000))+(0.3*500000)+(0.2*200000)+(0.1*100000);

DISPLAY name

DISPLAY tax

END main

END class

Program:
import java.util.Scanner;

public class Income


{
public static void main(String args[])
{
Scanner sc = new Scanner (System.in);
System.out.println("Enter name of Employee");
String name = sc.nextLine();
double tax=0.0,ti;
System.out.println("Enter income ");
ti=sc.nextDouble();
if(ti<=200000)
{
tax=0;
}
else if(ti<=300000)
{
tax=0.1*(ti-200000);
}
else if(ti<=500000)
{
tax=(0.2*(ti-300000))+(0.1*100000);
}
else if(ti<=1000000)
{
tax=(0.3*(ti-500000))+(0.2*200000)+(0.1*100000);
}
else
{
tax=(0.4*(ti-1000000))+(0.3*500000)+(0.2*200000)+(0.1*100000);
}
System.out.println("*****************************************");
System.out.println("Name of the Employee: "+name);
System.out.println("Income tax amount is "+tax);
System.out.println("*****************************************");
}
}
Variable Description

Name of the variable Data Type Purpose/Description


name String to store the name of
employee
tax Double to store the value
ti Double to store income

OUTPUT:
Enter name of Employee
Aditi Singh
Enter income
250000
*****************************************
Name of the Employee: Aditi Singh
Income tax amount is 5000.0
*****************************************

You might also like