-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDetails.java
More file actions
146 lines (135 loc) · 4.85 KB
/
Details.java
File metadata and controls
146 lines (135 loc) · 4.85 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package Project;
import java.util.*;
public class Details {
static LinkedList<Stack> ll = new LinkedList<>();
static Scanner sc = new Scanner(System.in);
public static void display(Stack<Integer> bal)
{
if(bal.empty())
return;
int x = bal.peek();
bal.pop();
System.out.println(x);
display(bal);
bal.push(x);
}
public static void features(int n) {
int InitialBalance = 5000;
int cho;
Scanner ob=new Scanner(System.in);
Stack<Integer> bal = new Stack<Integer>();
Stack<Integer> history = new Stack<Integer>();
bal.add(InitialBalance);
do
{
System.out.println("\n**Home Page**");
System.out.println("1.Check balance");
System.out.println("2.Fund Transfer");
System.out.println("3.Transaction History");
System.out.println("4.Loan\n5.Check Bank details");
System.out.println("0.Exit\n");
System.out.println("Enter your Choice");
cho=sc.nextInt();
switch(cho)
{
case 1:
System.out.println("*Check balance*");
System.out.println(bal.pop());
break;
case 2:
System.out.println("*Fund Transfer*");
System.out.println("1. Withdraw");
System.out.println("2. Deposit");
System.out.println("3. Transfer to another account");
System.out.println("Enter your choice :");
int ch3 = sc.nextInt();
switch(ch3)
{
case 1:
System.out.println("*Withdraw*");
System.out.println("Enter the amount");
int w = ob.nextInt();
history.add(-w);
if(w<InitialBalance)
{
InitialBalance=InitialBalance-w;
bal.push(InitialBalance);
// System.out.println("New Balance : " + InitialBalance);
}
else
{
System.out.println("Insuffient Balance\n Money cannot be withdrawn");
}
break;
case 2:
System.out.println("*Deposit*");
System.out.println("Enter the amount");
int d = ob.nextInt();
history.add(+d);
InitialBalance=InitialBalance+d;
bal.push(InitialBalance);
// System.out.println("New Balance : " + InitialBalance);
break;
case 3:
System.out.println("*Transfer to another account*");
System.out.println("Enter sender account number : ");
System.out.println("Enter receiver account number : ");
break;
}
break;
case 3:
System.out.println("*Transaction History*");
display(history);
break;
case 4:
System.out.println("Loan");
System.out.println("Enter account number");
break;
case 5:
for(int i=0;i<ll.size();i++){
System.out.println("Account "+(i+1)+": "+ll.get(i));
}
break;
case 0:
System.out.println("Thank you");
System.exit(0);
}
}while(cho!=6);
}
public static void main(String[] args) {
System.out.println("Hello User!!!");
System.out.print("Name: ");
String name = sc.nextLine();
System.out.print("Set MPIN: ");
String mpin = sc.next();
System.out.println("No of account to be added: ");
int n= sc.nextInt();
for(int i=0;i<=n-1;i++){
System.out.println("Add bank account\n1)Yes\n2)later");
int ch=sc.nextInt();
switch(ch){
case 1:
Stack<String> stk = new Stack<>();
System.out.print("IFSC code: ");
String ifcs = sc.next();
stk.add(ifcs);
System.out.print("Account no: ");
String acc = sc.next();
stk.add(acc);
System.out.print("CRN: ");
String crn = sc.next();
stk.add(crn);
ll.add(stk);
System.out.println("Account added Succefully!!!!");
break;
case 2:
System.out.println("Home page loading");
features(n);
break;
default: System.out.println("Invalid input");
break;
}
}
features(n);
}
}