예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the staff payroll screen");
            Console.WriteLine("enter 1. to display Salary");
            Console.WriteLine("enter 2. to display Wages");
            Console.Write("Enter option: ");
            int option = int.Parse(Console.ReadLine());

            Console.WriteLine();//adding blank spaces
            Console.WriteLine();

            //using if statements to run either Salary or Wages
            if (option == 1)
            {
                Salary s1 = new Salary();//object of Salary class created
                Console.WriteLine(s1.DisplaySalary());


                Console.WriteLine();//adding 2 blank lines
                Console.WriteLine();
            }

            else if (option == 2)
            {
                Wages w1 = new Wages();//object of Wages class created
                Console.Write("Enter the number of hours worked: ");
                int numhours = int.Parse(Console.ReadLine());
                Console.WriteLine(w1.DisplayWages(numhours));
                Console.ReadLine();
            }
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Salary salary = new Salary();

            Console.WriteLine("Your salary per week is $" + salary.DisplaySalary());
            Console.WriteLine("\n"); //two blank lines???
            Wages wages = new Wages();

            Console.Write("Enter the number of hours worked: ");
            int numHours = int.Parse(Console.ReadLine());

            Console.WriteLine("Your wages per week is $" + wages.DisplayWages(numHours));
            Console.ReadKey();
        }