forked from GoCool5/SampleJavaPrograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThreeInputs.java
More file actions
46 lines (28 loc) · 941 Bytes
/
ThreeInputs.java
File metadata and controls
46 lines (28 loc) · 941 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
41
42
43
44
45
46
package sample;
import java.util.Scanner;
public class ThreeInputs {
public static void main(String[] args)
{
Scanner sc1= new Scanner(System.in);
System.out.println("Enter the value 1");
int inputNumber1=sc1.nextInt();
System.out.println("Enter the value 2");
int inputNumber2=sc1.nextInt();
System.out.println("Please enter the action you want to perform... 1. Add 2. Subtract 3.Multiplication 4. Division");
int userInput=sc1.nextInt();
//System.out.println("you have choosen option "+userInput);
switch(userInput)
{
case 1: System.out.println("you have choosen option "+userInput+":Addition "+(inputNumber1+inputNumber2));
break;
case 2: System.out.println(inputNumber1-inputNumber2);
break;
case 3: System.out.println(inputNumber1*inputNumber2);
break;
case 4: System.out.println(inputNumber1/inputNumber2);
break;
default:System.out.println("Invalid Input");
break;
}
}
}