import java.util.Scanner; public class Calculator { public static void main(String[] args) { double num1, num2, answer; int response = 1; String op; Scanner in = new Scanner(System.in); System.out.println("This program will do addition and subtraction calcualtions "); while(response == 1) { System.out.println("Please enter a number, an operator (+ or -), and another number. "); num1 = in.nextDouble(); op = in.next(); num2 = in.nextDouble(); if(op.equals("+")) answer = add(num1, num2); // these methods are here just to show how to call method and how to write them else answer = sub(num1,num2); System.out.println("The answer is " + answer); System.out.println("If you want to continue, enter 1, otherwise enter 2"); response = in.nextInt(); } }// end main public static double add(double number1, double number2) { return number1 + number2; }// end add method public static double sub(double numb1, double numb2) { System.out.println("Not impelemnted yet"); // example of stubbing in a method return 0.0; } } // class Calculator