| / / Addition two numbers
import javax.swing.*;// this package call in JOptionPane
public class Addition
{ public static void main(String args[])
{
String fristNumber;
String secondNumber;
String result;
int number1;
int number2;
// Ask tthe user to input two number
firstNumber=JOptionPane.showInputDialog(''Enter first number'');
secondNumber=JOptionpane.showInputDialog(''Enter second number'');
// Methods below convert from string to int
number1=Integer.parseInt(firsNumber);
number2=Integer.parseInt(secondNumber);
// formule that make addition of two numbers
result=number1+number2;
JOptionPane.showMessageDialog(null, '' the addition of two number is''+result); // Message dialog that will show the addition of two numbers
}
}
I hope that this will help you !
****Naim**** |