⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calculatetaxes.java

📁 《A first book of java》by Gary J.Bronson 北大出版社
💻 JAVA
字号:
import javax.swing.*;
import java.text.*;  // needed for formatting
public class CalculateTaxes
{
  public static void main(String[] args)
  {
    double taxable, taxes;
    String s1;
    DecimalFormat df = new DecimalFormat(",###.00");
    s1 =JOptionPane.showInputDialog("Please type in the taxable income:");
    taxable = Double.parseDouble(s1);
     
    if (taxable <= 20000.0)
      taxes = 0.02 * taxable;
    else
      taxes = 0.025 * (taxable - 20000.0) + 400.0;
    JOptionPane.showMessageDialog(null, "Taxes are $" + df.format(taxes), 
                                "Program 4.1", 
                                JOptionPane.INFORMATION_MESSAGE);
    
    System.exit(0);  
  }
}

⌨️ 快捷键说明

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