首页 > 试题广场 >

(财务应用程序:计算将来的学费)假设今年某大学的学费为 10

[问答题]
(财务应用程序:计算将来的学费)假设今年某大学的学费为 10 000 美元,学费的年增长率为 5%。 — 年后,学费将是 10 500美元。编写程序,计算丨0年后的学费.以及从现在开始的10年后算 起,4 年内总学费是多少?
public class Test {
	public static void main(String[] args){
	
		
		//程序说明:计算十年后的学费
		//计算
		double s = 10000.0,e = 0,t = 0;
		int i = 1;
		DecimalFormat df = new DecimalFormat("######0.00");
		while(i <= 13)
		{
			
			s = s + (s * 0.05);
			if(i == 10)
				t = s;
			if(i >= 10)
			{
				e = e + s;
			}
			i++;
		}
			//显示学费
		System.out.println("Tuition in ten years is " + df.format(t));
		System.out.println("The four-year tuition in ten years is " + df.format(e));
    }
}

发表于 2020-02-25 16:21:55 回复(0)