2011年7月11日 星期一

[Java] 輸入數目

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package test;



import javax.swing.JOptionPane;



/**

*

* @author luke

*/

public class Test {



/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

int peoples;

int hands;



String strPeoples;



strPeoples = JOptionPane.showInputDialog("輸入人的數目");



peoples=Integer.parseInt(strPeoples);



JOptionPane.showMessageDialog(null, "人共有"+peoples+"個","提醒你。。。",JOptionPane.INFORMATION_MESSAGE);

hands=peoples*4;



JOptionPane.showMessageDialog(null, "共有"+hands+"手","提醒你。。。",JOptionPane.INFORMATION_MESSAGE);



System.exit(0);

}

}

Related Posts:

0 意見:

張貼留言