Esempio n. 1
0
        public static double GetClearSalary(Employee emp)
        {
            double salary     = PositionSalaryContainer.getInstance().GetSalary(emp.Pos);
            double expPersent = GetPercentOfExtraSalary(emp.Experience);
            double clearSal   = salary + (salary * (expPersent / 100));

            return(clearSal);
        }
 public static PositionSalaryContainer getInstance()
 {
     if (instance == null)
     {
         instance = new PositionSalaryContainer();
     }
     return(instance);
 }
        static void Main(string[] args)
        {
            //========= TASK 1 =======================================
            Console.WriteLine("======================= Task1 =========================");
            Console.WriteLine();

            Address myAddress = new Address();

            myAddress.Index     = 1;
            myAddress.Country   = "Ukraine";
            myAddress.City      = "Dnepr";
            myAddress.Street    = "Topol";
            myAddress.House     = "1a";
            myAddress.Apartment = 5;

            Console.WriteLine(myAddress.ToString());
            Console.WriteLine();

            //=========== TASK 2 ========================================
            Console.WriteLine("======================= Task2 =========================");
            Console.WriteLine();


            Console.Write("Enter the first length of rectangle: ? ");
            double len1 = AskDoubleUntilOk();

            Console.Write("Enter the second length of rectangle: ? ");
            double len2 = AskDoubleUntilOk();

            Rectangle rect = new Rectangle(len1, len2);

            Console.WriteLine("Area: {0}", rect.Area);
            Console.WriteLine("Perimeter: {0}", rect.Perimeter);
            Console.WriteLine();

            //=========== TASK 3 ========================================
            Console.WriteLine("======================= Task3 =========================");
            Console.WriteLine();

            Book myBook = new Book("Tom Sawyer", "Mark Twain", " PREFACE \n CHAPTER I \n CHAPTER II \n ... \n CONCLUSION");

            myBook.Show();
            Console.WriteLine();

            //=========== TASK 4 ========================================
            Console.WriteLine("======================= Task4 =========================");

            Point  p1  = new Point(1, 1, "A");
            Point  p2  = new Point(2, 2, "B");
            Point  p3  = new Point(3, 2, "C");
            Point  p4  = new Point(4, 1, "D");
            Figure fig = new Figure(p1, p2, p3, p4);

            Console.WriteLine("Figures name: {0}", fig.FiguresName);
            Console.WriteLine("Figures perimeter: {0}", fig.FiguresPerimeter);
            Console.WriteLine();

            //=========== TASK 5 ========================================
            Console.WriteLine("======================= Task5 =========================");

            User user = new User("Aniks", "Andrew", "Martunyk", 25, new DateTime(2019, 12, 6));

            Console.WriteLine(user.ToString());
            Console.WriteLine();

            //=========== TASK 6 ========================================
            Console.WriteLine("======================= Task6 =========================");

            Conventer conventer = new Conventer(0.042, 0.038, 2.69);

            Console.WriteLine(conventer.Convert(Currency.RUB, 255, Currency.UAH));
            Console.WriteLine();

            //=========== TASK 7 ========================================
            Console.WriteLine("======================= Task7 =========================");

            PositionSalary salary1 = new PositionSalary(Position.doctor, 5000);
            PositionSalary salary2 = new PositionSalary(Position.driver, 4000);
            PositionSalary salary3 = new PositionSalary(Position.teacher, 4500);

            PositionSalaryContainer.getInstance().AddPositionSalary(salary1);
            PositionSalaryContainer.getInstance().AddPositionSalary(salary2);
            PositionSalaryContainer.getInstance().AddPositionSalary(salary3);

            Employee emp = new Employee("Andrew", "Martunyk", Position.teacher, 4.5);

            Console.WriteLine(emp.ToString());
            Console.WriteLine();

            //=========== TASK 8 ========================================
            Console.WriteLine("======================= Task7 =========================");

            Invoice invoice = new Invoice(12213, "Andrew", "Aniks", "toothpaste", 20, 23.22);

            Console.WriteLine(invoice.ToString());
            Console.WriteLine();


            Console.ReadKey();
        }