checklimit.java

来自「《A first book of java》by Gary J.Bronson 」· Java 代码 · 共 23 行

JAVA
23
字号
import javax.swing.*;
import java.text.*;  // needed for formatting
public class CheckLimit
{
  public static void main(String[] args)
  {
    final double LIMIT = 3000.0;
    String s1;
    double mileage;
    System.out.println("Please enter the mileage: ");
    mileage = Double.parseDouble(s1);
     
    if(mileage > LIMIT)
      JOptionPane.showMessageDialog(null, "For a mileage of " + mileage 
                      + "\nThis car is over the mileage limit", "Program 4.3", 
                      JOptionPane.INFORMATION_MESSAGE);
    
    JOptionPane.showMessageDialog(null, "End of Program", "Program 4-3", 
                                  JOptionPane.INFORMATION_MESSAGE);
    
    System.exit(0);  
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?