示例#1
0
        public static HourlyEmployee createHourly()
        {
            string  fName, lName, age, ID, hPay, hWorked;
            int     ageNumber, IDNumber;
            decimal hPayNumber, hWorkedNumber;

            // add a hourly employee
            Console.WriteLine("Employee first name?");
            fName = Console.ReadLine();

            while (!IsAlphabetic.IsAllAlphabetic(fName))
            {
                Console.WriteLine("Enter a valid first name.");
                fName = Console.ReadLine();
            }

            Console.WriteLine("Employee last name?");
            lName = Console.ReadLine();

            while (!IsAlphabetic.IsAllAlphabetic(lName))
            {
                Console.WriteLine("Enter a valid last name.");
                lName = Console.ReadLine();
            }

            Console.WriteLine("Employee age?");
            age       = Console.ReadLine();
            ageNumber = Convert_ToInt.ConvertToInt(age);

            Console.WriteLine("Employee ID number?");
            ID       = Console.ReadLine();
            IDNumber = Convert_ToInt.ConvertToInt(ID);

            Console.WriteLine("Employee hourly pay?");
            hPay       = Console.ReadLine();
            hPayNumber = Convert_ToDecimal.ConvertToDecimal(hPay);

            Console.WriteLine("Employee hours worked?");
            hWorked       = Console.ReadLine();
            hWorkedNumber = Convert_ToDecimal.ConvertToDecimal(hWorked);

            Console.WriteLine("");

            HourlyEmployee he = new HourlyEmployee(fName, lName, ageNumber, IDNumber, hPayNumber, hWorkedNumber);

            return(he);
        }
示例#2
0
        public static SalariedEmployee createSalaried()
        {
            string  fName, lName, age, ID, mPay;
            int     ageNumber, IDNumber;
            decimal mPayNumber;

            // add a salaried employee

            Console.WriteLine("Employee first name?");
            fName = Console.ReadLine();

            while (!IsAlphabetic.IsAllAlphabetic(fName))
            {
                Console.WriteLine("Enter a valid first name.");
                fName = Console.ReadLine();
            }

            Console.WriteLine("Employee last name?");
            lName = Console.ReadLine();

            while (!IsAlphabetic.IsAllAlphabetic(lName))
            {
                Console.WriteLine("Enter a valid last name.");
                lName = Console.ReadLine();
            }

            Console.WriteLine("Employee age?");
            age       = Console.ReadLine();
            ageNumber = Convert_ToInt.ConvertToInt(age);

            Console.WriteLine("Employee ID number?");
            ID       = Console.ReadLine();
            IDNumber = Convert_ToInt.ConvertToInt(ID);

            Console.WriteLine("Employee monthly pay?");
            mPay       = Console.ReadLine();
            mPayNumber = Convert_ToDecimal.ConvertToDecimal(mPay);

            Console.WriteLine("");

            SalariedEmployee se = new SalariedEmployee(fName, lName, ageNumber, IDNumber, mPayNumber);

            return(se);
        }