0

I have error in the top of this program not sure what I did wrong.

```
import javax.swing.JOptionPane;
public class Main_Class {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
class wk2 {
private static final char Y = 0;
/**
* @param args
*/
public void main(String[] args) {
// declare variables
int input1, input2, sum, diff, product, average, absolute, max, min, adjusted1, adjusted2, newSum;
// welcome message
JOptionPane.showMessageDialog(null, "By xxx, " +
"Class CIS247B.\nThis program asks for two intergers, calculates and display their sum, difference, product and average.\n" +
"Press OK to begin, follow prompts...\n", "NumberGames",JOptionPane.INFORMATION_MESSAGE);
do {
// get input
String number1 = JOptionPane.showInputDialog(null,"Enter first integer","Input for Calculations",
JOptionPane.QUESTION_MESSAGE); // get first integer
input1 = Integer.parseInt(number1); // convert first integer from string to integer type
String number2 = JOptionPane.showInputDialog(null,"Enter second integer","Input for Calculations",
JOptionPane.QUESTION_MESSAGE); // get second integer
input2 = Integer.parseInt(number2); // convert second integer from string to integer type
// do calculations
sum = input1 + input2; // add integers and initialize sum
diff = input1 - input2; // subtract integers and initialize diff (for difference)
product = input1 * input2; // multiply integers and initialize product
average = sum / 2;
absolute = (diff < 0) ? -diff : diff;
max = (input1 > input2) ? input1 : input2;
min = (input1 < input2) ? input1 : input2;
// display results
String output = "The two integers you entered are " + number1 +" and " + number2 + ".\n" +
"Their sum is " + sum + " ("+ number1 + "+" + number2 + "=" + sum + ").\n" +
"Their difference is " + diff + " ("+ number1 + "-" + number2 + "=" + diff + ").\n" +
"Their product is " + product + " ("+ number1 + "x" + number2 + "=" + product + ").\n" +
"Their average is " + average + " ("+ sum + " divided by 2 = " + average + ").\n" +
"The absolute value of their difference is " + absolute + ".\n" +
"The maximum number is " + max + ".\n" +
"The minimum number is " + min + "." ;
JOptionPane.showMessageDialog(null, output, "Output",JOptionPane.INFORMATION_MESSAGE);
// if both numbers are greater than 100, then subtract 100 from each.
if (input1 > 100 && input2 > 100) {
adjusted1 = input1 - 100;
adjusted2 = input2 - 100;
String output2 = "Both interger values are greater than 100, therefore their values have been adjusted as follows:\n" +
"The first integer's value is now " + adjusted1 + ". ("+ input1 + " - 100).\n" +
"The second integer's value is now " + adjusted2 + ". ("+ input2 + " - 100).";
JOptionPane.showMessageDialog(null, output2, "Output",JOptionPane.INFORMATION_MESSAGE);
}
// if both numbers are negative, then add 200 to their sum.
if (input1 < 0 && input2 < 0) {
newSum = sum + 200;
String output2 = "Both interger values are negative, therefore their sum has been adjusted as follows:\n" +
"200 has been added to the sum of both integers. (" + input1 + " + " + input2 +" + 200 = " + newSum + ")";
JOptionPane.showMessageDialog(null, output2, "Output",JOptionPane.INFORMATION_MESSAGE);
}
System.out.println("continue loop");
} while ( JOptionPane.showConfirmDialog(null, "Do it again?") == JOptionPane.YES_OPTION);
String output3 = "Thank you for using my program.";
JOptionPane.showMessageDialog(null, output3, "Output",JOptionPane.INFORMATION_MESSAGE);
}
}
}
}
```

*Edited 3 Years Ago by Dani*: Formatting fixed