Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the staff payroll system"); //Intro
            Console.WriteLine("Enter 1 to display Salary");
            Console.WriteLine("Enter 2 to display Wages");
            Console.Write("Enter option: ");                //Asking person to select an option
            int option = int.Parse(Console.ReadLine());     //Creating option to store variable

            Console.Write("\n\n");                          //Adding 2 clear lines

            if (option == 1)                                //If statement to display Salary if option 1 is selected
            {
                Salary salary1 = new Salary();              //Creating the salary object
                Console.WriteLine(salary1.DisplaySalary()); //Calling the method to display the weekly salary.
                Console.ReadLine();
            }

            else if (option == 2)                                    //Else if to display Wages if 2 is selected
            {
                Wages wages1 = new Wages();                          //Creating the wages object
                Console.Write("Enter the amount of hours worked: "); //Asking for hours worked
                int hours = int.Parse(Console.ReadLine());           //Setting the variable
                Console.WriteLine(wages1.DisplayWages(hours));       //Calling the method to display wages
                Console.ReadLine();
            }

            else //Else to display if anything other than 1 or 2 is entered
            {
                Console.WriteLine("Sorry, that was not an option");
                Console.ReadLine();
            }
        }
Example #2
0
        static void Main(string[] args)
        { //method
            Console.WriteLine("Welcome to the staff payroll system");
            Console.WriteLine("enter 1. to display salary");
            Console.WriteLine("enter 2. to display wages");
            Console.Write("Please enter the button"); ;
            int button = int.Parse(Console.ReadLine());

            
            {
                // salary class// 
                Salary s1 = new Salary();
                Console.WriteLine($"In per week is youe salary${Math.Round(s1.DisplaySalary(), 2)}");

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


            
            {
                // wages class//
                Wages w1 = new Wages();
                Console.Write("please enter the hour worked");
                int hours = int.Parse(Console.ReadLine());
                Console.WriteLine($"Wages per week ${Math.Round(w1.DisplayWages(hours), 2)}");
                Console.ReadLine();
            }




        }
        public static void Main(string[] args)
        {
            Salary s1 = new Salary();

            s1.AnnualSalary = 80000;

            Console.WriteLine($"your Salary is set at {s1.AnnualSalary} per year.");
            Console.WriteLine($"Your Weekly Salary per week is ${s1.DisplaySalary()}.\n\n");

            Wages w1 = new Wages();

            w1.HourlyRate = 33.72;

            Console.WriteLine($"I will calculate your Wages.");
            Console.Write($"Enter the number of hours worked: ");
            w1.NumHours = int.Parse(Console.ReadLine());
            Console.WriteLine($"Your Wages per week is ${w1.DisplayWages()}.");
            Console.ReadLine();
        }
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            //Salary Object
            Salary s1 = new Salary();

            //To display the weeklySalary
            Console.WriteLine(DisplaySalary);
            //2 Blank Spaces
            Console.WriteLine();
            Console.WriteLine();
            //The Wages Object
            Wages w1 = new Wages();

            //Prompting the user to enter in the hours worked
            Console.WriteLine("Enter the number of hours worked: ");
            int numhours = int.Parse(Console.ReadLine());

            Console.WriteLine(WagesDisplayMeth());
            //Uses the display wages method to display the weekly wages
            Console.WriteLine(DisplayWages);
        }