-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.java
81 lines (66 loc) · 2.31 KB
/
Customer.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
76
77
78
79
80
81
package simpleBank;
import java.util.ArrayList;
public class Customer {
static ArrayList <Customer> list = new ArrayList<>();
private String name;
private String mobNumber;
private String userId;
private String password;
private double bal;
public Customer(String name, String mobNumber,String id,String pass){
this.name = name;
this.mobNumber = mobNumber;
this.userId = id;
this.password = pass;
this.bal =0;
}
public String getName(){
return this.name;
}
public String getMob(){
return this.mobNumber;
}
public String getId() {
return this.userId ;
}
public String getPass(){
return this.password;
}
public double getAmount(){
return this.bal;
}
public void updateAmount(double money){
this.bal += money;
}
//ADDING CUSTOMER TO THE ARRAY LIST
public void addCustomer(Customer C){
list.add(C);
}
static int i = 0; // THIS i INDICATE THE CURRENT VERIFIED CUSTOMER INDEX NO.
//CHECKING USER_ID AND PASSOWRD WITH THE AVAILABLE LIST
public static boolean checkValidate(String id, String pass,int count){
for (i =0;i<count;i++){
// System.out.println(list.get(i).getId() +" "+list.get(i).getPass());
// list.get(i).getId();list.get(i).getPass();
if(id.equals(list.get(i).getId()) && pass.equals(list.get(i).getPass()) ){
return true;
}
}
return false;
}
public static void showDetails(){
System.out.println("-------------------------------------------------------------------------------");
System.out.println("Name: "+list.get(i).getName()+"\tMob: "+list.get(i).getMob()+"\tUserID: "+list.get(i).getId() +"\tPassW: "+list.get(i).getPass()+"\tBal: "+list.get(i).getAmount());
System.out.println("-------------------------------------------------------------------------------");
}
public static void addBal(double money){
list.get(i).updateAmount(money);
}
public static void withdraw(double money){
if(list.get(i).getAmount() < money){
System.out.println("\tSorry! low balence");
return;
}
list.get(i).updateAmount(-money);
}
}