-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.java
82 lines (65 loc) · 2.09 KB
/
Account.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
82
package Constructor;
public class Account {
private String number;
private double balance;
private String customerName;
private String customerEmail;
private String customerPhone;
public Account() {
System.out.println("Empty constructor called");
}
public Account(String number, double balance, String customerName, String email,
String phone) {
System.out.println("Account constructor with parameters called");
this.number = number;
this.balance = balance;
this.customerName = customerName;
customerEmail = email;
customerPhone = phone;
}
public void depositFunds(double depositAmount) {
balance += depositAmount;
System.out.println("Deposit of $" + depositAmount + " made. New balance is $" +
balance);
}
public void withdrawFunds(double withdrawalAmount) {
if (balance - withdrawalAmount < 0) {
System.out.println("Insufficient Funds! You only have $" + balance +
" in your account.");
} else {
balance -= withdrawalAmount;
System.out.println("Withdrawal of $" + withdrawalAmount +
" processed, Remaining balance = $" + balance);
}
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
}