gravatar

T1047-求大佬解答!错哪儿了!

845520 at 2017-11-21T06:00:19+00:00 Go TO Problem T1047

<!--Markdown--> <!--Markdown--> import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int n = input.nextInt(); double money = 10000; double b = 0; double z = 1; while (z <= n) { money = Math.ceil(money * (1 + 0.05) * 100) / 100; z++; } b = money + Math.ceil(money * (1 + 0.05) * 100) / 100 + Math.ceil(money * (1 + 0.05) * (1 + 0.05) * 100) / 100 + Math.ceil(money * (1 + 0.05) * (1 + 0.05) * (1 + 0.05) * 100) / 100; System.out.printf("Tuition after " + n + " year: " + "%.2f", money); System.out.println(); System.out.printf("Tuition for 4 year: " + "%.2f", b); } }

Comments:

gravatar 20171113737
2017-11-27T04:52:07+00:00
<!--Markdown-->