forked from Nitheesh-SG/BankApllication
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserTransactionHistory.java
More file actions
44 lines (43 loc) · 1.43 KB
/
UserTransactionHistory.java
File metadata and controls
44 lines (43 loc) · 1.43 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
/*
@Banking application - With the help of this application we can create new bank
account and other banking operation's.
@Author - Nitheesh G.
@Created at - 02-11-2021
@Updated at - 02-16-2021
@Reviewed by - Anto
*/
package bankapplication;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
public class UserTransactionHistory {
void usertransactionhistory()
{
@SuppressWarnings("resource")
Scanner input=new Scanner(System.in);
HashSet<UserDetails>TransactionDetailSet=BankingOperation.UserDetailSet;
int flag = 0;
System.out.println("Enter Account number: ");
int accntNumber = input.nextInt();
Iterator<UserDetails> iterator = TransactionDetailSet.iterator();
UserDetails userdetails;
while(iterator.hasNext())
{
userdetails = (UserDetails) iterator.next();
if(userdetails.getAccountnumber()== accntNumber)
{
flag = 1;
System.out.println("Credit | Debit | Total");
for(History s : userdetails.TransactionHistory)
{
System.out.println(s.CreditAmount + " | " + s.DebitAmount + " | " + s.TotalAmount+"\n");
}
break;
}
}
if(flag == 0)
{
System.out.println("BankAccount Not Available\n");
}
}
}