コード例 #1
0
        static void Main(string[] args)
        {
            Salary s1 = new Salary();

            s1.AnnualSalary = 80000;
            Console.WriteLine($"Your salary is set at {s1.AnnualSalary}");
            Console.WriteLine($"Your salary per week is ${Math.Round (s1.DisplaySalary(),2)}");
            Console.WriteLine("");
            Console.WriteLine("");

            Console.WriteLine("I will calculate your wages");
            Console.Write("Enter the numbers of hour worked: ");
            int   hour = int.Parse(Console.ReadLine());
            Wages w1   = new Wages();

            w1.NumHour = 33.72;
            Console.WriteLine($"Your wages per week is ${w1.DisplayWages()}");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: 9977559/Semester1
    {//PROGRAM TO CALCULATE SALARY AND WAGES
        //DANIEL HOLLANDER
        static void Main(string[] args)
        {
            //START POINT
start:
            //MENU SYSTEM TO CHOOSE BETWEEN SALARY AND WAGES
            Console.WriteLine("Welcome to the payroll System\n" +
                              "Enter 1: to Display Salary\n" +
                              "Enter 2: to Display Wages\n" +
                              "Enter 1 or 2: \n");
            int one = int.Parse(Console.ReadLine());

            if (one == 1)
            {
                //SALARY
                Console.WriteLine("Your salary is set at $80000 per year");
                //SET AT 80000
                Salary E1 = new Salary(80000, 0);
                //TWO BLANK LINES
                Console.WriteLine("Your salary per week is: $" + E1.DisplaySalary() + "\n\n");
                Console.ReadLine();
            }
            else if (one == 2)
            {
                //WAGES
                Wages E2 = new Wages(0);
                Console.WriteLine("I Will Calculate your wages...");
                Console.WriteLine("Enter the number of hours worked: ");
                int hours = int.Parse(Console.ReadLine());
                //INT TAKES THE USER IMPUT FOR NUMBER OF HOURS WORKED
                E2.NumHours = hours;
                //USER IMPUT = NUMHOURS
                Console.WriteLine("Your wages per week are: $" + E2.DisplayWages());
                Console.ReadLine();
            }
            else
            {
                //IF USER DOESNT ENTER 1 OR 2 GOES TO START OF APP
                Console.WriteLine("Option not recognised... Try Again");
                goto start;
            }
        }