Hi all, I'm trying to create a program where the user inputs two numbers, the first will be the multiplication table and the second will be by how many many times tables to be shown. I'm having trouble getting the variables right.
import javax.swing.JOptionPane;
public class InputMultiply {
public static void main (
String[]args) {
String input = JOptionPane.showInputDialog("Enter a multiplier");
String inputa = JOptionPane.showInputDialog("Enter the number of problems you want to display");
int input1 = input;
int input2 = inputa;
int answer;
for (input=1; input2 <= input2; input2++)
{
answer = input1 * input2;
System.out.println(input1 + "*" + input2 + "=" + answer);
}
System.exit(0);
}
}
I get the error:
C:\java\bin>javac InputMultiply.java
InputMultiply.java:13: incompatible types
found : java.lang.String
required: int
int input1 = input;
^
InputMultiply.java:14: incompatible types
found : java.lang.String
required: int
int input2 = inputa;
^
InputMultiply.java:18: incompatible types
found : int
required: java.lang.String
for (input=1; input2 <= input2; input2++)
Any suggestions?