2018-11-08 C#工资计算器

2018-11-08  本文已影响0人  f387b2061819

纯手打牛逼程序
工资计算器
让我们算算裴裴工作到65岁能赚多少钱呢
(无bug无敌版)

        {/***
          * 编写程序,
          * 估计一个职员在65岁退休之前能赚到多少钱。
          * 用年龄和超始薪水作为输入,
          * 并假设职员每年工资增长5%。
          * */
            double sum = 0;
            int age=0;
            double M=0;
                Console.WriteLine("请输入年龄");
                    try{
                        age = Convert.ToInt32(Console.ReadLine());
                    }catch {
                        Console .WriteLine ("有误");
                    }
                Console .WriteLine ("起始工资");
                    try{
                         M = Convert.ToInt32(Console.ReadLine());
                    }catch {
                        Console .WriteLine ("有误");
                    }
                    sum = M;
                while (age<65 )
                    {
                    M=M*(1.05);
                    sum +=M ;
                    age++;
                    }
                Console.WriteLine(sum);      
                Console.ReadKey();
            
                }```
上一篇下一篇

猜你喜欢

热点阅读