import java.util.Scanner; class CalculatorA { public static void main(String [] args){ Scanner console = new Scanner(System.in); int operand1,operand2; char operator; System.out.println("Enter two integers followed by one of the operators (+ - * /)"); operand1 = console.nextInt(); operand2 = console.nextInt(); operator = console.next().charAt(0); if(operator == '+'){ System.out.println(operand1 + " + " + operand2 + " = " + (operand1 + operand2)); } else if(operator == '-'){ System.out.println(operand1 + " - " + operand2 + " = " + (operand1 - operand2)); } else if(operator == '*'){ System.out.println(operand1 + " * " + operand2 + " = " + (operand1 * operand2)); } else if(operator == '/'){ if(operand2 !=0 ){ System.out.println(operand1 + " / " + operand2 + " = " + (operand1 / operand2)); }else{ System.out.println("Cannot divide by 0"); } } else{ System.out.println(operator + " is an invalid operator"); } } }