Thursday 19 September 2013

JOptionPane error on Eclipse

JOptionPane error on Eclipse

I am VERY new to Java (ie week 2 of AP Computer Science A). we have to use
JOptionPane to make message boxes to use with math operations. My code was
fine at school but I had to reformat it because I saved it on Facebook (no
other option). Now I get errors on all the JOptionPane lines saying
"Multiple markers at this line" and " Syntax error on tokens". How do I
fix that. here is the code (please only fix what I am asking, nothing
else, I know the code is probably weird)
import javax.swing.JOptionPane;
public class OptioPane {
public static void main(String[] args) {
}
String a = JOptionPane.showInputDialog("Enter an integer");
String b = JOptionPane.showInputDialog("Input another");
int x = Integer.parseInt(a);
int y = Integer.parseInt(b);
JOptionPane.showMessageDiaglog(null, "The numbers added together is "
+(x+y));
String c = JOptionPane.showInputDialog("Enter an integer");
String d = JOptionPane.showInputDialog("Input another");
int f = Integer.parseInt(c);
int g = Integer.parseInt(d);
JOptionPane.showMessageDialog(null, "The second number subtracted from
the first number is " +(f-g));
String s = JOptionPane.showInputDialog("Enter an integer");
String r = JOptionPane.showInputDialog("Input another");
int w = Integer.parseInt(a);
int q = Integer.parseInt(b);
JOptionPane.showMessageDialog(null, "The numbers multiplied together
is " +(w*q));
String k = JOptionPane.showInputDialog("Enter an integer");
String j = JOptionPane.showInputDialog("Input another");
int n = Integer.parseInt(a);
int m = Integer.parseInt(b);
JOptionPane.showMessageDialog(null, "The first number divided by the
second number is " +(n/m));
String fir = JOptionPane.showInputDialog("Enter an integer");
String tir = JOptionPane.showInputDialog("Input another");
int ah = Integer.parseInt(a);
int bh = Integer.parseInt(b);
JOptionPane.showMessageDialog(null, "The first number modulated by the
second number is " +(ah*bh));
}

No comments:

Post a Comment