-
Notifications
You must be signed in to change notification settings - Fork 0
/
Do_While_Task.java
73 lines (60 loc) · 1.86 KB
/
Do_While_Task.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package Practice;
import static java.lang.System.out;
import java.util.Scanner;
public class Do_While_Task
{
public int a;
public int b;
public int Sum(int a,int b)
{
return a+b;
}
public int Subtract(int a, int b)
{
return a-b;
}
public int Multiply(int a, int b)
{
return a*b;
}
public int Divide(int a,int b)
{
return a/b;
}
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
Do_While_Task obj = new Do_While_Task();
char character = 'c';
do
{
int a = scan.nextInt();
int b = scan.nextInt();
char Char = scan.next().charAt(0);
obj.Sum(a, b);
obj.Subtract(a, b);
obj.Multiply(a, b);
obj.Divide(a, b);
switch(Char)
{
case 'S':
out.println("Sum of two numbers:-\t" + obj.Sum(a, b));
break;
case 'T':
out.println("Subtact of two numbers:-\t" + obj.Subtract(a, b));
break;
case 'M':
out.println("Multiply of two numbers:-\t" + obj.Multiply(a, b));
break;
case 'D':
out.println("Divide of two numbers:-\t"+ obj.Divide(a, b));
break;
default :
out.println("The Character You Put Has No Values Here");
}
out.println("Input Character For Continue:-\t");
character = scan.next().charAt(0);
}
while(character=='c');
}
}