答案 0 :(得分:0)
public void h(){
Scanner s = new Scanner(System.in);
System.out.println("What you Want to do = ");
String k = s.nextLine();
System.out.println("Enter the value of a = ");
int a = s.nextInt();
System.out.println("Enter the value of b = ");
int b = s.nextInt();
if(("p").equals(k) || (("+").equals(k))){
sum = a+b;
System.out.println("Sum = "+sum);
}
else if(("s").equals(k) || (("-").equals(k))){
sum = a-b;
System.out.println("Sum = "+sum);
}
else if(("m").equals(k) || (("*").equals(k))){
sum = a*b;
System.out.println("Sum = "+sum);
}
else if(("d").equals(k) || (("/").equals(k))){
sum = a/b;
System.out.println("Sum = "+sum);
}else{
System.out.println("Enter the correct work to do");
}