forked from sourabh48/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanking.java
More file actions
90 lines (84 loc) · 1.69 KB
/
banking.java
File metadata and controls
90 lines (84 loc) · 1.69 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
82
83
84
85
86
87
88
89
90
import java.io.*;
class information
{
int x=0,withdrawamt=0, dipositamt=0, principle=0,accountnumber=0;
DataInputStream dis= new DataInputStream(System.in);
public void opening()
{
try
{
System.out.println("Enter the account number");
accountnumber=Integer.parseInt(dis.readLine());
System.out.println("Enter the principle amount");
x=Integer.parseInt(dis.readLine());
if(x>=1000)
{
System.out.println("Account Created");
principle=x;
System.out.println("Your account has:Rs "+principle);
}
else
System.out.println("Account Terminated");
}
catch(Exception e)
{}
}
public void diposit()
{
try
{
System.out.println("Enter the amount to be withdrawn");
dipositamt=Integer.parseInt(dis.readLine());
principle=principle+dipositamt;
System.out.println("YOUR BALANCE: "+principle);
}
catch(Exception e)
{}
}
public void withdraw()
{
try
{
System.out.println("Enter the amount to be withdrawn");
withdrawamt=Integer.parseInt(dis.readLine());
principle=principle-withdrawamt;
System.out.println("YOUR REMAINING BALANCE:"+principle);
}
catch(Exception e)
{}
}
}
public class banking
{
public static void main(String args[])
{
DataInputStream disp= new DataInputStream(System.in) ;
information i=new information();
i.opening();
int a=0;
try
{
System.out.println("IF YOU WANT TO DIPOSIT PRESS 1 OR IF YOU WANT TO WITHDRAW PRESS 2");
a=Integer.parseInt(disp.readLine());
}
catch(Exception e)
{}
switch(a)
{
case 1:
{
i.diposit();
break;
}
case 2:
{
i.withdraw();
break;
}
default:
{
System.out.println("INVAILD INPUT....!!!!!! ");
}
}
}
}