zoukankan      html  css  js  c++  java
  • 用c#语言编写银行利率

    sing System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {

             Console.WriteLine("*********************************");

              Console.WriteLine("欢迎来到XX银行,你可以在这里进行定期存款,获得的收益按照以下              规则进行计算");
               Console.WriteLine("1.存款期1年以内,按照收益4%的年利率计算利息");
               Console.WriteLine("2.存款期2-5年,按照4.8%的年利率计算利息");
               Console.WriteLine("3.存款期5年以上(不含5年),按照5.2%的年利率计算利息");
               Console.WriteLine("4.若存款金额超过50万9(含50万),存款到期后,还回获得利息10%             的收益");
                Console.WriteLine("**********************************");

               Console.WriteLine("请输入你的存款金额(万元):);

                decimal saveMoney = decial.Parse(Console.ReadLine());

                 Console.Write("请输入你的存款期限(年): “);

                int year = int.Parse(Console.ReadLine());

                //总收益 = 利息收益 + 额外收益

                // 计算利息收益 = 本金 * 年利率 * 年份

                decimal rate;  //表示年利率

                 if (year == i)

                 { 

                        rate = 0.04m;

                  }

                  else if (year >= 2&& year <= 5)

                  {

                          rate = 0.048m;

                   }

                    else 

                    {  

                            rate = 0.052m;

                       }

                      decimal rateMoney = savemMoney * rate *year * 10000;

                       //计算额外收益

                       decimal extraMoney = 0;

                        if (saveMoney >= 50)

                       {

                             extraMoney = rateMoney * 0.1m;

                        }

                           decimal all = rateMoney + extraMoney;

                           Console.write("恭喜你,存你将获得“ + 款成功, ” +year + "年后到期,你将获得” + all + “元的收益”) ;   

                            Console.ReadLine();

                       }

             }

    }    

         

  • 相关阅读:
    Git官方推荐用书
    二叉树-补习
    POJ 2251 Dungeon Master(三维BFS)
    Codeforces 675C Money Transfers (思维题)
    HDU 1195 Open the Lock(BFS)
    HDU 1010 Tempter of the Bone(DFS+剪枝)
    POJ 1426 Find The Multiple(DFS,BFS)
    POJ 3216 Prime Path (BFS)
    POJ 3278 Catch that cow(BFS)
    UVa 572 Oil Deposits(简单DFS)
  • 原文地址:https://www.cnblogs.com/yangkaiming/p/8733257.html
Copyright © 2011-2022 走看看