和差积商

源代码:

import javax.swing.JOptionPane;
public class Addition{
public static void main(String [] args){
String firstNumber,secondNumber;
int number1,number2,sum,differ,pro,quo;
firstNumber = JOptionPane.showInputDialog("输入第一个数");
secondNumber = JOptionPane.showInputDialog("输入第二个数");
number1 = Integer.parseInt(firstNumber);
number2 = Integer.parseInt(secondNumber);
sum = number1 + number2;
differ = number1 - number2;
pro = number1 * number2;
quo = number1/number2;
JOptionPane.showMessageDialog(null,"和是:"+sum,"Results",
JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"差是:"+differ,"Results",
JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"积是:"+pro,"Results",
JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,"商是:"+quo,"Results",
JOptionPane.PLAIN_MESSAGE);
System.exit( 0 );
}
}

 

posted @ 2017-10-09 20:52  瓜大wjs  阅读(542)  评论(0编辑  收藏  举报