-
Notifications
You must be signed in to change notification settings - Fork 2
/
calculator.java
50 lines (45 loc) · 1.75 KB
/
calculator.java
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
47
48
49
50
import java.util.*;
class add{
public static void main(String args[]){
Scanner x = new Scanner(System.in);
System.out.println("PLEASE ENTER FIRST NUMBER a: ");
double a = x.nextDouble();
Scanner y = new Scanner(System.in);
System.out.println("PLEASE ENTER SECOND NUMBER b: ");
double b = y.nextDouble();
System.out.println( + a + " + " + b + " is " + (a + b));
}
}
class subtract{
public static void main(String args[]){
Scanner x = new Scanner(System.in);
System.out.println("PLEASE ENTER FIRST NUMBER a: ");
double a = x.nextDouble();
Scanner y = new Scanner(System.in);
System.out.println("PLEASE ENTER SECOND NUMBER b: ");
double b = y.nextDouble();
System.out.println( + a + " - " + b + " is " + (a - b));
}
}
class multiplication {
public static void main(String args[]){
Scanner x = new Scanner(System.in);
System.out.println("PLEASE ENTER FIRST NUMBER a: ");
double a = x.nextDouble();
Scanner y = new Scanner(System.in);
System.out.println("PLEASE ENTER SECOND NUMBER b: ");
double b = y.nextDouble();
System.out.println( + a + " X " + b + " is " + (a * b));
}
}
class division{
public static void main(String args[]){
Scanner x = new Scanner(System.in);
System.out.println("PLEASE ENTER FIRST NUMBER a: ");
double a = x.nextDouble();
Scanner y = new Scanner(System.in);
System.out.println("PLEASE ENTER SECOND NUMBER b: ");
double b = y.nextDouble();
System.out.println("quotient of " + a + " / " + b + " is " + (a / b)+ " and remainder is " +(a % b));
}
}