集册 Java实例教程 计算投资测验

计算投资测验

欢马劈雪     最近更新时间:2020-01-02 10:19:05

552
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
创建一个程序来计算


public class Main {/**来 自 时 代 J a v a - nowjava.com**/

    public static void main(String[] arguments) {

        float total = 14000;

        System.out.println("Original investment: $" + total);

        // Inceases by 40 percent the first year

        total = total + (total * .4F);

        System.out.println("After one year: $" + total);

        // Loses $1,500 the second year

        total = total - 1500F;

        System.out.println("After two years: $" + total);

        // Increases by 12 percent the third year

        total = total + (tota
展开阅读全文