码迷,mamicode.com
首页 > 其他好文 > 详细

和差积商

时间:2017-10-09 22:27:25      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:res   port   inpu   void   input   cond   second   first   main   

源代码:

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 );
}
}

 

和差积商

标签:res   port   inpu   void   input   cond   second   first   main   

原文地址:http://www.cnblogs.com/wjwjs/p/7642945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!