Java 新手,编程方面相对较新。下面的代码是已经完美运行的程序的最后几行——我只想对最终结果(newTuition 变量)进行四舍五入并将其限制为两位有效数字。
newTuition、TUITIONINCREASE 和学费都是双倍的。
newTuition = ((TUITIONINCREASE * .01) * tuition) + tuition + ".");
System.out.println("Your current tuition is $" + tuition + ". It will rise next year by " + TUITIONINCREASE + "% and " +
"your new tuition will be $" + newTuition);