public class DivideTwoGui
1: import javax.swing.*;
2:
3: public class DivideTwoGui
4: {
5: public static void main(String[] args)
6: {
7: String input;
8: JOptionPane.showMessageDialog(
9: null, "This program divides two numbers.");
10:
11: input = JOptionPane.showInputDialog("Enter the numerator:");
12: int numerator = Integer.parseInt(input);
13:
14: input = JOptionPane.showInputDialog("Enter the denominator:");
15: int denominator = Integer.parseInt(input);
16:
17: JOptionPane.showMessageDialog(
18: null, numerator + "/" + denominator + " = " +
19: (double) numerator/denominator);
20:
21: System.exit(0);
22: }
23: }