import java.util.Scanner; /** * Basic class to perform basic functions for our Graphing Calculator * (+, -, *, /) * Lauren Green * 10/19/18 */ public class Basic { int input1 = 0; int input2 = 0; int answer; public Basic() { boolean validInput = false; while(!validInput) { //Get input of first number input1 = Console.getIntegerInput("What is the first number?"); //Get input of type of function String operation = Console.getStringInput("Which operation would you like to perform? \n +, -, *, /"); //Get input of second number input2 = Console.getIntegerInput("What is the second number?"); //Do the math depending on the input. if (operation.equals("+")) { answer = input1 + input2; System.out.println(answer); validInput = true; } else if (operation.equals("-")) { answer = input1 - input2; System.out.println(answer); validInput = true; } else if (operation.equals("*")) { answer = input1 * input2; System.out.println(answer); validInput = true; } else if (operation.equals("/")) { answer = input1 / input2; System.out.println(answer); validInput = true; } else { System.out.println("Error, try again \n"); } } //Insert return to main menu. } }