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

📄 joptionpaneexam.java

📁 Java程序设计实用教程源代码 本书源代码按章分别放置在不同的文件夹中,所有程序均在JDK1.6环境下编译运行正常,除了第13章需要建立ODBC数据源之外,其他程序只要有Java运行环境即可直接运行
💻 JAVA
字号:
import java.text.NumberFormat;
import java.util.Locale;
import javax.swing.*;
public class joptionPaneExam {
  public static void main(String args[]) {
    double count, prin = 1000.0, rate = 0.038;
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance(Locale.US);
    JTextArea jta = new JTextArea();
    jta.setText("存款年数\t本金+利息\n");
    for (int year = 1; year <= 10; year++) {
      count = prin * Math.pow(1.0 + rate, year);
      jta.append(year + "\t" + moneyFormat.format(count) + "\n");
    }
    JOptionPane.showMessageDialog(null, jta, "定期储蓄",
                                  JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
  }
}

⌨️ 快捷键说明

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