I am supposed to convert a program i already made into a Java console application that uses the Scanner class to read the user's input. This is the code i have that i need to convert. I don't know where to start. Here is the code

import javax.swing.JOptionPane;
public class HW3 {

public static void main (String args[])
{

String firstNum;
String secondNum;
int num1;
int num2;
int sum;
int difference;
int quotient;
int product;

firstNum = JOptionPane.showInputDialog("Enter first integer: " );
secondNum = JOptionPane.showInputDialog("Enter second integer: " );
num1 = Integer.parseInt( firstNum );
num2 = Integer.parseInt( secondNum );
sum = num1 + num2;
difference = num1 - num2;
product = num1 * num2;
quotient = num1 / num2;

JOptionPane.showMessageDialog(null, "The sum is " + sum,
"Results", JOptionPane.PLAIN_MESSAGE );
JOptionPane.showMessageDialog(null, "The difference is " + difference);
JOptionPane.showMessageDialog(null, " The quotient is" + quotient);
JOptionPane.showMessageDialog(null, "The product is" + product);
System.exit( 0 );
}
}

The Scanner method for reading in an int is nextInt().

You need to instantiate a Scanner, and replace the inputs and outputs.

Instead of

firstNum = JOptionPane.showInputDialog("Enter first integer: " );
secondNum = JOptionPane.showInputDialog("Enter second integer: " );

using a Scanner, you will have

// instantiate scanner
Scanner kb = new Scanner(System.in);
// output dialog
out.print("Enter first integer: ");
// input int
firstNum = kb.nextInt();
// second int
out.print("Enter second integer: ");
secondNum = kb.nextInt();

Now you need to change your output.

Instead of

JOptionPane.showMessageDialog(null, "The sum is " + sum,

include simple printlines.

System.out.println("The sum is "+sum);

And do the same for the rest of the output.

To convert your Java program to a console application using the `Scanner` class to read user input, follow these steps:

1. Remove the import statement for `javax.swing.JOptionPane` since we won't be using it anymore.

2. Add an import statement for the `java.util.Scanner` class at the beginning of your code: `import java.util.Scanner;`

3. Replace the line `String firstNum;` with `int num1;`.

4. Replace the line `String secondNum;` with `int num2;`.

5. Remove the lines `firstNum = JOptionPane.showInputDialog("Enter first integer: " );` and `secondNum = JOptionPane.showInputDialog("Enter second integer: " );`.

6. Create a new instance of the `Scanner` class to read user input. Add the following line before the variable declarations: `Scanner scanner = new Scanner(System.in);`

7. Replace the line `num1 = Integer.parseInt( firstNum );` with `num1 = scanner.nextInt();`.

8. Replace the line `num2 = Integer.parseInt( secondNum );` with `num2 = scanner.nextInt();`.

9. Replace all the lines starting with `JOptionPane.showMessageDialog(null, ...` with `System.out.println("The sum is " + sum);` and similar statements using `System.out.println` to display the results.

10. Remove the line `System.exit(0);` as it is not necessary in a console application.

Once you have made these modifications, your program should be converted to a console application that reads user input using the `Scanner` class.

Here is the modified code:

```
import java.util.Scanner;

public class HW3 {
public static void main(String args[]) {
int num1;
int num2;
int sum;
int difference;
int quotient;
int product;

Scanner scanner = new Scanner(System.in);

System.out.print("Enter first integer: ");
num1 = scanner.nextInt();

System.out.print("Enter second integer: ");
num2 = scanner.nextInt();

sum = num1 + num2;
difference = num1 - num2;
product = num1 * num2;
quotient = num1 / num2;

System.out.println("The sum is " + sum);
System.out.println("The difference is " + difference);
System.out.println("The quotient is " + quotient);
System.out.println("The product is " + product);
}
}
```

Now, when you run the program, it will prompt the user to enter two integers through the console, and then it will compute and display the sum, difference, product, and quotient of the entered numbers.