# Anyone can explain this?

Printable View

• 03-08-2011, 02:54 AM
kazumahits
Anyone can explain this?
Code:

```import javax.swing.JOptionPane; public class jop {     public static void main(String[] args) {     String i1 =         JOptionPane.showInputDialog( "Enter first Number" );     String i2 =         JOptionPane.showInputDialog( "Enter second Number" );     String i3 =         JOptionPane.showInputDialog( "Menu \n1:Addition\n2:Subtraction\n3:Multiplication\n4:Division" );     int n1 = Integer.parseInt( i1 );     int n2 = Integer.parseInt( i2 );     int n3 = Integer.parseInt( i3 );     int a1 = n1 + n2;     int a2 = n1 - n2;     int a3 = n1 * n2;     int a4 = n1 / n2;     if (n3 == 1) {         JOptionPane.showMessageDialog( null, "The sum is " + a1, "Sum of Two Integers", JOptionPane.PLAIN_MESSAGE );     }     else if (n3 == 2) {         JOptionPane.showMessageDialog( null, "The difference is " + a2, "Difference of Two Integers", JOptionPane.PLAIN_MESSAGE );     }     else if (n3 == 3) {         JOptionPane.showMessageDialog( null, "The Product is " + a3, "Product of Two Integers", JOptionPane.PLAIN_MESSAGE );     }     else if (n3 == 4) {         JOptionPane.showMessageDialog( null, "The Quotient is " + a4, "Quotient of Two Integers", JOptionPane.PLAIN_MESSAGE );     } else { JOptionPane.showMessageDialog(null, "Please Enter a Valid Number"); }     } }```
i cant explain this... please help me...
• 03-08-2011, 03:03 AM
sunde887
This has got to be a homework dump, this program is so simple to understand. Try compiling and running it, see if that helps you explain it.