-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMessage.java
More file actions
32 lines (27 loc) · 1021 Bytes
/
Message.java
File metadata and controls
32 lines (27 loc) · 1021 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
package calculator;
import java.util.HashMap;
/**
* Message class
* - message output class
*
* return type : void
*/
public class Message {
HashMap<String, String> exceptionMessageList = new HashMap<String, String>();
// Result output method when operation is normally performed
public void calculationResult(int result){
System.out.print("결과 : ");
System.out.println(result);
}
// Error message list management method
private void exceptionMessageList(){
exceptionMessageList.put("NOT_OPERATOR", "사칙연산 기호에 해당하지 않는 기호가 존재합니다.");
exceptionMessageList.put("INVALID_EQUATION", "잘못된 연산식입니다.");
exceptionMessageList.put("INVALID_DIVIDE", "0으로 나눌수가 없습니다.");
}
// Error message output method
public void exceptionResult(String exceptionKeyword){
exceptionMessageList();
System.out.println(exceptionMessageList.get(exceptionKeyword));
}
}