简易加法计算器
2008-01-05 09:32:05 来源:WEB开发网核心提示:这是一个非常简单的整数加法计算器程序,希望大家给些意见,简易加法计算器, import javax.swing.JOptionPane; public class Addition { public static void main (String args[]) { String firstNum, secondNu
这是一个非常简单的整数加法计算器程序,希望大家给些意见。
import javax.swing.JOptionPane;
public class Addition {
public static void main (String args[]) {
String firstNum, secondNum;
int num1, num2, sum;
firstNum = JOptionPane.showInputDialog
("Enter first integer");
secondNum = JOptionPane.showInputDialog
("Enter secong integet");
num1 = Integer.parseInt(firstNum);
num2 = Integer.parseInt(secondNum);
sum = num1 + num2;
JOptionPane.showMessageDialog(
null,"The sum is "+ sum,
"Results",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
} }
赞助商链接