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

📄 interest.java

📁 北京邮电大学牛导的 JAVA课件课件及相关资料
💻 JAVA
字号:
//某人在银行存了15万,利率为2.5%每年,求10年的存款额import javax.swing.JOptionPane;import javax.swing.JTextArea;import java.util.Locale;import java.text.NumberFormat;public class Interest {        public static void main(String[] args)     {        String inputmoney, index;        JTextArea indexarea;        int counter;        double input, year, interest[];        inputmoney = JOptionPane.showInputDialog("请输入你需要的存额:");        input = Double.parseDouble(inputmoney);        interest = new double[10];        year = 1;        index = " year" + "\t" + "Interest" + "\n";        NumberFormat mf = NumberFormat.getCurrencyInstance();        for(counter = 0; counter< 10; counter++)        {            interest[counter] = input * Math.pow(1+0.025,counter+1);                        index = index + (counter+1) + "\t" + mf.format(interest[counter]) + "\n";        }        indexarea = new JTextArea();        indexarea.setText(index);        JOptionPane.showMessageDialog(null,indexarea,"Interest",JOptionPane.INFORMATION_MESSAGE);        System.exit(0);                }    }

⌨️ 快捷键说明

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