-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank.java
75 lines (68 loc) · 2.18 KB
/
Bank.java
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
//NIHAN AKINCI
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
public class Bank
{
static ArrayList <Customer> CustomerList = new ArrayList<>();
Scanner in = new Scanner(System.in);
int counter = 0;
public void deleteCustomer(Customer c1,int idd)
{
for (Iterator<Customer> it = CustomerList.iterator(); it.hasNext(); )
{
c1 = it.next();
if(c1.getId() == idd)
{
it.remove();
}
}
}
public void listAll()
{
Iterator <Customer> list1 =CustomerList.iterator();
while(list1.hasNext())
{
System.out.println(list1.next());
}
}
public void listByName(Customer c1,String name)
{
for (Customer customerName : CustomerList)
{
if(customerName.getName().equals(name))
{
System.out.println(customerName);
counter ++;
}
}
System.out.printf("\n%d records found.\n", counter);
counter = 0 ;
}
public void listBySurname(Customer c1,String surname)
{
for (Customer customerSurname : CustomerList)
{
if(customerSurname.getSurname().equals(surname))
{
System.out.println(customerSurname);
counter ++;
}
}
System.out.printf("\n%d records found.\n", counter);
counter = 0 ;
}
public void listByGender(Customer c1,String gender)
{
for (Customer customerGender : CustomerList)
{
if(customerGender.getGender().equals(gender))
{
System.out.println(customerGender);
counter ++;
}
}
System.out.printf("\n%d records found.\n", counter);
counter = 0 ;
}
}