- 1
WHAT IS WRONG WITH MY PROGRAM
Creating times table using dialog box, JOptionPane package userinput; import javax.swing.JOptionPane; public class Program { public static void main(String[] args) { int number, multiplier; JOptionPane.showInputDialog("Number you wish to multiply"); for (multiplier=1;multiplier<=10;multiplier++ ) { JOptionPane.showMessageDialog(null, "%d * %d = %d/n", number, multiplier,(number * multiplier)); } } }
2 Answers
+ 4
As far as I understand, SoloLearn does not have a file with this library, so your code will not work here.
I don't understand this library, but judging by logic your code should look something like this:
package userinput;
import javax.swing.JOptionPane;
public class Program
{
public static void main(String[] args) {
String input =
JOptionPane.showInputDialog("Number you wish to multiply");
int number = Integer.parseInt(input);
for(int multiplier=1;multiplier<=10;multiplier++){
JOptionPane.showMessageDialog(null, ("%d * %d = %d\n", number, multiplier, number * multiplier));
}
}
}
+ 1
Is it the same as this?
https://www.sololearn.com/Discuss/3090236/?ref=app
I can't test the ui on sololearn. Do you want to display each calculation individually?