forked from wvsu-cict-cit207/students
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAct2BR.java
More file actions
27 lines (24 loc) · 1.1 KB
/
Act2BR.java
File metadata and controls
27 lines (24 loc) · 1.1 KB
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
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Act2BR {
public static void main(String[] args) {
//create an object of BR - why do we need to create an object???
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println("Enter first number: ");
String strNum1 = br.readLine();
System.out.println("Enter second number: ");
String strNum2 = br.readLine();
int num1 = Integer.parseInt(strNum1);
int num2 = Integer.parseInt(strNum2);
System.out.println(num1 + " + " + num2 + " = " + (num1 + num2));
System.out.println(num1 + " * " + num2 + " = " + (num1 * num2));
System.out.println(num1 + " - " + num2 + " = " + (num1 - num2));
System.out.println(num1 + " / " + num2 + " = " + (num1 / num2));
System.out.println(num1 + " % " + num2 + " = " + (num1 % num2));
} catch (IOException e) {
e.printStackTrace();
}
}
}