示例#1
0
        private void ApplyRaise(Employee someone)
        {
            //Ask user for a raise amount
            Console.Write("Enter a raise amount (2-10): ");
            double raise = double.Parse(Console.ReadLine());

            while (raise < 2 || raise > 10)
            {
                Console.WriteLine("Not a valid number.");
                Console.WriteLine("Enter a raise amount (2-10): ");
                raise = double.Parse(Console.ReadLine());
            }

            raise = raise / 100;
            someone.AssignBonus(raise);
        }
示例#2
0
 private void ApplyRaise(Employee someone)
 {
     // Ask user for a raise amount, between 2 and 10 inclusive
     Console.Write("Enter raise amount (2-10): ");
     double raise = double.Parse(Console.ReadLine());
     while (raise < 2 || raise > 10)
     {
         Console.WriteLine("Not a valid number.");
         Console.Write("Enter raise amount (2-10): ");
         raise = double.Parse(Console.ReadLine());
     }
     // BUG #1: forgot to adjust for being a percentage...
     raise = raise / 100;
     // change the employee's salary
     someone.AssignBonus(raise);
 }
示例#3
0
        private void ApplyRaise(Employee someone)
        {
            //Ask user for a raise amount, between 2 and 10 inclusive
            Console.Write("Enter raise percentage (2-10%): ");
            double raiseAmount = Double.Parse(Console.ReadLine());

            while (raiseAmount < 2 || raiseAmount > 10)
            {
                Console.WriteLine("Not a valid number!");
                Console.Write("Enter raise amount (2-10): ");
                raiseAmount = Double.Parse(Console.ReadLine());
            }
            raiseAmount = raiseAmount / 100; //convert into a percentage
            // Change the employee's salary
            someone.AssignBonus(raiseAmount);
        }
示例#4
0
文件: Program.cs 项目: ddbar/cctb-145
        private void ApplyRaise(Employee someone)
        {
            // Ask user for a raise amount, between 2 and 10 inclusive
            Console.WriteLine("enter raise amount (2-10):");
            double raise = double.Parse(Console.ReadLine());

            while (raise < 2 || raise > 10)
            {
                Console.WriteLine("Not a valid number.");
                Console.WriteLine("enter raise amount (2-10):");
                raise = double.Parse(Console.ReadLine());
            }
            // BUG #1: forgot to adjust for being a percentage..
            raise = raise / 100;
            // change the employee's salary
            someone.AssignBonus(raise);
        }
示例#5
0
        private void ApplyRaise(Employee someone)
        {
            //Ask user for raise amount, between 2 and 10 inclusive
            Console.Write("Enter raise amount (2-10): ");
            double raise = double.Parse(Console.ReadLine());

            while (raise < 2 || raise > 10)
            {
                Console.WriteLine("Not a valid value!");
                Console.Write("Enter raise amount (2-10): ");
                raise = double.Parse(Console.ReadLine());
            }

            raise = raise / 100;
            //change someone's salary
            someone.AssignBonus(raise);
        }