-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCashPayment.java
More file actions
40 lines (30 loc) · 1000 Bytes
/
CashPayment.java
File metadata and controls
40 lines (30 loc) · 1000 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
package practice;
public class CashPayment extends Payment {
private String cashReceiptNumber;
public CashPayment(String shopName, String productName, long productPrice, String cashReceiptNumber) {
super(shopName, productName, productPrice);
this.cashReceiptNumber = cashReceiptNumber;
}
@Override
public String toString() {
return "현금이 정상적으로 지불되었습니다.\n"
+ "[ 현금 결제 정보 ]\n"
+ "상점명 : " + shopName + "\n"
+ "상품명 : " + productName + "\n"
+ "상품가격 : " + productPrice + "\n"
+ "현금영수증번호 : " + cashReceiptNumber;
}
@Override
public void pay() throws PayException {
// TODO Auto-generated method stub
if (productPrice <= 0 ) {
throw new PayException("가격이 잘못되었습니다.");
}
}
public String getCashReceiptNumber() {
return cashReceiptNumber;
}
public void setCashReceiptNumber(String cashReceiptNumber) {
this.cashReceiptNumber = cashReceiptNumber;
}
}