1 static void Main(string[] args)
2 {
3 Console.WriteLine("*****************************************************");
4 Console.WriteLine("欢迎来到中国银行,您可以在这里进行定期存款,获得的收益将按照以下规则进行计算");
5 Console.WriteLine("1.存款期1年以内,按照4%的年利率计算利息");
6 Console.WriteLine("2.存款期2-5年,按照4.8%的年利率计算利息");
7 Console.WriteLine("3.存款期5年以上(不含5年),按照5.2%的年利率计算利息");
8 Console.WriteLine("4.若存款金额超过50(含50万),存款到期后,还会获得利息10%的收益");
9
10 Console.Write("请输入存款金额(万元):");
11 decimal money = decimal.Parse(Console.ReadLine());
12 Console.Write("请输入存款年限(年):");
13 int year = int.Parse(Console.ReadLine());
14 decimal rate;
15 if (year == 1)
16 {
17 rate = 0.04m;
18 }
19 else if (year >= 2 && year <= 5)
20 {
21 rate = 0.048m;
22 }
23 else
24 { rate = 0.052m;
25 }
26 decimal rateMoney = money * rate * year * 1000;
27
28 decimal extraMoney = 0;
29 if (money >= 50)
30 {
31 extraMoney = rateMoney * 0.1m;
32 }
33 decimal all = rateMoney + extraMoney;
34 Console.Write("恭喜你,存款成功,"+year+"年到期后,你将获得"+all+"元的收益利息");
35
36 Console.ReadLine();
37 }