-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT07.java
More file actions
81 lines (65 loc) · 1.68 KB
/
YT07.java
File metadata and controls
81 lines (65 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import java.io.*;
class YT07
{
String name;
int PAN;
double taxableIncome, tax;
public YT07()
{
name=" ";
PAN=0;
taxableIncome=0.0;
tax=0.0;
}
public void input(String n, int p, double t)
{
name=n;
PAN=p;
taxableIncome=t;
}
public void calculate()
{
if(taxableIncome<=60000)
{
tax=0;
}
else if(taxableIncome>60000 && taxableIncome<=150000)
{
tax=0.05*taxableIncome;
}
else if(taxableIncome>150000 && taxableIncome<=500000)
{
tax=0.1*taxableIncome;
}
else
{
tax=0.15*taxableIncome;
}
}
public void display()
{
System.out.println();
System.out.println("Name:"+ name);
System.out.println("PAN Number:"+ PAN);
System.out.println("Taxable Income:"+ taxableIncome);
System.out.println("Tax:"+ tax);
}
public static void main(String[] args)throws IOException
{
String n1;
int p1;
double t1;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the name:");
n1=br.readLine();
System.out.println("Enter the pan number:");
p1=Integer.parseInt(br.readLine());
System.out.println("Enter the taxable income:");
t1=Double.parseDouble(br.readLine());
YT07 T1 = new YT07();
T1.input(n1, p1, t1);
T1.calculate();
T1.display();
}
}