What did I do wrong here? I was trying to make a calculator for my AP Comp Science class and it turned out now to work.. I followed the teachers instructions but it didn't work. Does anyone have any suggestions on how to fix this?Thanks
import java.util.*; public class d { public static void main(String[] args) { /*Scanner input = new Scanner(System.in); System.out.println("What are you doing?"); if (answer.equalsIgnorecase("multiplication")) { Multiplication(); }*/ System.out.println("Hello, If you are doing Multiplication Type 1."); System.out.println("If you are doing Addition, Type 2."); System.out.println("If you are doing Subtraction, Type 3"); System.out.println("If you are doing Division, Type 4"); Scanner input = new Scanner(System.in); int decision; decision = input.nextInt(); if (decision == 1) { Multiplication(); } if (decision == 2) { Addition(); } if (decision == 3) { Subtraction(); } if (decision == 4) { Division(); } else { System.out.println("Those aren't valid numbers."); } } } public static void Multiplication() { int mInput1; int mInput2; Scanner input = new Scanner(System.in); System.out.print("What is the first number? "); mInput1 = input.nextInt(); System.out.print("What is the second number? "); mInput2 = input.nextInt(); System.out.println(mInput1 + " times " + mInput2 + " equals " + mInput1 * mInput2); } public static void Addition() { int aInput1; int aInput2; int aAnswer; Scanner input = new Scanner(System.in); System.out.println("What is the first number?"); aInput1 = input.nextInt(); System.out.println("What is the second number?"); aInput2 = input.nextInt(); aAnswer = aInput1 + aInput2; System.out.println(aInput1 + " plus " + aInput2 + " equals " + aAnswer); } public static void Subtraction() { int sInput1; int sInput2; int sAnswer; Scanner input = new Scanner(System.in); System.out.println("What is the first number?"); sInput1 = input.nextInt(); System.out.println("What is the second number?"); sInput2 = input.nextInt(); sAnswer = sInput1 - sInput2; System.out.println(sInput1 + " minus " + sInput2 + " equals " + sAnswer); } public static void Division() { int dInput1; int dInput2; int dAnswer; Scanner input = new Scanner(System.in); System.out.println("What is the first number?"); dInput1 = input.nextInt(); System.out.println("What is the second number?"); dInput2 = input.nextInt(); dAnswer = dInput2 / dInput1; System.out.println(dInput1 + " divided by " + dInput2 + " equals " + dAnswer); } }