0

I know I am missing somethings in my code not sure what I am supposed to put in. Here is what I have so far.

```
import javax.swing.JOptionPane;
public class Main_Class {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String firstNumber;//first number entered by user
String secondNumber;//second number entered by user
int input1;//converted first number that was entered
int input2;//converted second number that was entered
int sum;//sum of entered numbers
int difference;//difference of entered numbers
int product;//product of entered numbers
int absolute;
int num1, num2, min, max;
double average;//average of entered numbers
do {
//get the two numbers
//do the calculations
//display results
} while ( JOptionPane.showConfirmDialog(null, "Do it again?") == JOptionPane.YES_OPTION);
//read first number as a string
firstNumber = JOptionPane.showInputDialog("Enter first integer");
//read second number as a string
secondNumber = JOptionPane.showInputDialog("Enter second integer");
//convert strings to integers
input1 = Integer.parseInt(firstNumber);
input2 = Integer.parseInt(secondNumber);
//add the numbers together
sum = input1 + input2;
//calculate the difference
difference = input1 - input2;
//multiply the numbers
product = input1 * input2;
//calculate the average
average = (input1 + input2)/2;
//calculate the absolute value of the difference
int num, abs;
//get number
if (num < 0)
abs= -num;
else
abs = num;
//calculate the maximum
max = (num1 < num2) ? num1 : num2;
//calculate the minimum
min = (num1 < num2) ? num1 : num2;
//place the desired output for each variable into a string
String sumOutput = " The sum of your integers is: " +input1+ " + " +input2+ " = " +sum+ "\n";
String differenceOutput = " The difference of your integers is: " +input1+ " - " +input2+ " = " +difference+ "\n";
String productOutput = " The product of your integers is: " +input1+ " x " +input2+ " = " +product+ "\n";
String averageOutput = " The average of your integers is: (" +input1+ " + " +input2+ ") / 2 = "+average+ "\n";
String absoluteOutput = " The absolute value of your integers is: " +input1+ " - " +input2+ " = " +absolute+ "\n";
String maxOuput = "The maximum of your integers is: " +num1+ " + " +num2+ " = " +max+ "\n";
String minOuput = "The minimum of your integers is: " +num1+ " + " +num2+ " = " +min+ "\n";
//place all strings into one string
String totalOutput = sumOutput + differenceOutput + productOutput + averageOutput + absoluteOutput + maxiOutput + minOutput;
//display the results of your calculations and strings
JOptionPane.showMessageDialog(null, totalOutput);
//program termination message
JOptionPane.showMessageDialog(null,"This concludes the program");
System.exit(0);//terminate the application
}
}
```

*Edited 3 Years Ago by happygeek*: fixed formatting