Hzzzcz 2021-11-09 08:45 采纳率: 0%
浏览 58

银行利息实现银行根据存入的现金和年限计算利息

img

  • 写回答

1条回答 默认 最新

  • zt13502162671 2021-11-09 09:25
    关注

    public class Test(){
    public decimal Calculation(decimal Months,int principal){
    double r;
    decimal year = Math.Ceiling(Months/12);
    switch (year){
    case 1:r=0.025;break;
    case 2:r=0.03;break;
    case 3:r=0.037;break;
    case 4:r=0.04;break;
    case 5:r=0.05;break;
    }
    return yearrprincipal;
    }
    }

    public static void Main(string[] args){
    Test test = new Test();
    Console.Write(test.Calculation(5*12,10000));//5年,一万元;
    Console.Readline();
    }

    差不多就这样吧

    评论

报告相同问题?

问题事件

  • 创建了问题 11月9日