-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
46 lines (36 loc) · 974 Bytes
/
Account.java
File metadata and controls
46 lines (36 loc) · 974 Bytes
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
package thread.sync;
public class Account {
private String accId;
private int balance;
private String ownerName;
public Account() {
// TODO Auto-generated constructor stub
}
public Account(String accNo, int balance, String ownerName) {
super();
this.accId = accNo;
this.balance = balance;
this.ownerName = ownerName;
}
public void deposit(int price) {
this.balance = this.balance + price;
System.out.println(accId + " 계좌에 " + price + "만원이 입금되었습니다.");
}
public void withdraw(int price) {
this.balance = this.balance - price;
System.out.println(accId + " 계좌에 " + price + "만원이 출금되었습니다.");
}
public String getAccNo() {
return accId;
}
public void setAccNo(String accNo) {
this.accId = accNo;
System.out.println(accNo + " 계좌가 개설되었습니다.");
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
}