-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccount.java
More file actions
61 lines (53 loc) · 1.51 KB
/
Copy pathBankAccount.java
File metadata and controls
61 lines (53 loc) · 1.51 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
public class BankAccount {
private double acNum;
private double balance;
private String email;
private int phoneNumber;
public BankAccount(){
this(12345, 0.00, "null", 123456789);
System.out.println("Empty constructor called");
}
public BankAccount(double acNum, double balance, String email, int phoneNumber) {
this.acNum = acNum;
this.balance = balance;
this.email = email;
this.phoneNumber = phoneNumber;
}
public void deposit(double depositAmount){
this.balance += depositAmount;
System.out.println("Deposit of " + depositAmount +" successful. Your current balance is " + this.balance);
}
public void withdrawal(double withdrawalAmount){
if(this.balance - withdrawalAmount < 0){
System.out.println("You have too little in your account: " + this.balance);
}
else {
this.balance -= withdrawalAmount;
System.out.println("Withdrawal of " + withdrawalAmount + " success. Your remaining balance is " + this.balance);
}
}
public void setAcNum(double acNum){
this.acNum = acNum;
}
public double getAcNum(){
return this.acNum;
}
public void setBalance(double balance){
this.balance = balance;
}
public double getBalance(){
return this.balance;
}
public void setEmail(String email){
this.email = email;
}
public String getEmail(){
return this.email;
}
public void setPhoneNumber(int phoneNumber){
this.phoneNumber = phoneNumber;
}
public int getPhoneNumber(){
return this.phoneNumber;
}
}