示例#1
0
        static void Main(string[] args)
        {
            // MODULE 01 - TUTORIAL LABS
            var Car1 = new Car("White", 2010);

            Car1.Mileage = 11000;

            Console.WriteLine($"This car is painted {Car1.Color}, was built in {Car1.Year}, and has {Car1.Mileage} miles on it.");

            var Car2 = new Car("Red", 2008);

            int carCount = Car.CountCars();

            Console.WriteLine($"There are {carCount} cars on inventory right now.");

            // MODULE 02 - TUTORIAL LABS
            // var employee1 = new Employee("Libby", 20000);
            var employee2 = new TechinalEmployee("Zaynah");
            var employee3 = new BussinessEmployee("Winter");

            Console.WriteLine(employee2.employeeStatus() + " . . . " + employee3.employeeStatus());

            // Operador ternário
            double preco = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            double desconto =
                (preco < 20.0)
                ? preco * 0.1
                : preco * 0.05;

            /*
             * if (preco < 20.0)
             * {
             *  desconto = preco * 0.1;
             * }
             * else
             * {
             *  desconto = preco * 0.05;
             * }
             */

            Console.WriteLine(desconto);
        }
示例#2
0
        static void emplTest()
        {
            var employee1 = new Employee("Libby", 2000);
            var employee2 = new TechnicalEmployee("Zaynah");
            var employee3 = new BussinessEmployee("Winter");

            var employee1abs = new TechnicalEmployeeAbs("Libby");
            var employee2abs = new TechnicalEmployeeAbs("Zaynah");
            var employee3abs = new BussinessEmployeeAbs("Winter");

            Console.WriteLine($"{employee1.employeeStatus()} ... {employee2.employeeStatus()} ... {employee3.employeeStatus()}");

            Console.WriteLine($"{employee1abs.employeeStatus()} ... {employee2abs.employeeStatus()} ... {employee3abs.employeeStatus()}");
        }