Exercise02_11

 1 import javax.swing.JOptionPane; 
 2 public class Population{
 3 public static void main(String[] args){
 4 int sum,s,years;
 5 String number;
 6 number = JOptionPane.showInputDialog(null,"Enter the number of years:");
 7 years=Integer.parseInt(number);
 8 s=365*years*24*60*60;
 9 sum=312032486+s/7-s/13+s/45;
10 int messageType=JOptionPane.INFORMATION_MESSAGE;
11 String message="The population in " + years + " is " + sum;
12 JOptionPane.showMessageDialog(null,message,"result",messageType );
13 }
14 }
原文地址:https://www.cnblogs.com/cherrydream/p/9800693.html