-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalc.java
More file actions
27 lines (21 loc) · 798 Bytes
/
Calc.java
File metadata and controls
27 lines (21 loc) · 798 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
package chap06;
import java.util.Scanner;
//미니계산기 - if문
public class Calc {
public static void main(String[] args) {
Scanner key = new Scanner(System.in);
System.out.println("*******미니계산기*******");
System.out.println("1.더하기");
System.out.println("2.빼기");
System.out.println("3.곱하기");
System.out.println("4.나누기");
System.out.print("연산자를 선택하세요.");
int opr = key.nextInt();
System.out.print("숫자를 입력하세요 ");
int num1 = key.nextInt();
int num2 = key.nextInt();
MyMethodDemo method = new MyMethodDemo();
int result = method.calc(opr, num1, num2);
System.out.println("계산결과:"+result);
}
}