static void Main(string[] args)
 {
     IPayment kebab = new Payment("kebabcheta", 6);
     IPayment kufte = new Payment("kifteta", 6);
     List<IPayment> pokupki = new List<IPayment>();
     pokupki.Add(kebab);
     pokupki.Add(kufte);
     Customer a = new Customer("Pepa", "Petrova", "Pitkova", "8101111120",
         "*****@*****.**", "0989888888", "gr.Sofia,kv. Zaharna fabrika", CustomerType.Diamond,pokupki);
     Customer b = a.Clone() as Customer;
     IEnumerable<IPayment> payB = b.Payments;
     IPayment pastyrmichka = new Payment("pastyrma", 15);
     b.AddPayment(pastyrmichka);
     Console.WriteLine(a.Payments.Count());
     Console.WriteLine(b.Payments.Count());
 }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            int result = 0;
            List<int> fib = new List<int>();
            fib.Add(1);
            fib.Add(2);
            int num = 2;
            while (num < 4e6)
            {
                if (num % 2 == 0)
                    result += num;

                num = fib[fib.Count - 1] + fib[fib.Count - 2];
                fib.Add(num);
            }
            Console.WriteLine(result);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            List<User> users = new List<User>();

            users.Add(new User("Doug", 2349)); // 28
            users.Add(new User("Jordan", 2102)); // 23
            users.Add(new User("Eric", 2001)); // 25
            users.Add(new User("Johnathan", 1747)); // 22

            int answer = 1;
            foreach (User u in users)
            {
                Console.WriteLine(u.getTasks());
                answer *= u.getTasks();
            }
            Console.WriteLine("Answer = " + answer); // 354200 = 28 * 23 * 25 * 22
            Console.ReadKey();
        }
Esempio n. 4
0
        static void input(bool console, string filename = "input.txt")
        {
            string[] line = Console.ReadLine().Split();
            n = Int32.Parse(line[0]); m = Int32.Parse(line[1]);
            roads = new List<Tuple<int, int, short>>();
            int v1, v2;
            short l;
            for (int i = 0; i < m; i++)
            {
                line = Console.ReadLine().Split();
                v1 = Int32.Parse(line[0]) - 1; v2 = Int32.Parse(line[1]) - 1;
                l = Int16.Parse(line[2]);
                roads.Add(Tuple.Create(v1, v2, l));
            }

        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("../../../catalog.xml");

            XmlNode rootNode = doc.DocumentElement;

            List<string> albumNames = new List<string>();

            foreach (XmlNode node in rootNode.ChildNodes)
            {
                albumNames.Add(node.ChildNodes[0].InnerText);
            }

            foreach (var albumName in albumNames)
            {
                Console.WriteLine(albumName);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            int start = 1;
            int end = 100;
            List<int> numbers = new List<int>();

            while(numbers.Count<count)
            {
                try
                {
                    int number = ReadNumber(start, end);
                    numbers.Add(number);
                    start = number;
                }
                catch(FormatException fe)
                {
                    Console.WriteLine("This is not a number!");
                }
                catch(OverflowException oe)
                {
                    Console.WriteLine("This is not an integer!");

                }
                catch(ArgumentOutOfRangeException aore)
                {
                    Console.WriteLine("Number is out of range");

                }
                catch(NotPossibleToCompleteException npe)
                {
                    Console.WriteLine(npe.Message);

                }

            }
            Console.Clear();
            Console.WriteLine("These are input numbers");
            numbers.ForEach(n => Console.WriteLine(n));
        }
Esempio n. 7
0
 public object Clone()
 {
     List<IPayment> clonedPayments = new List<IPayment>();
     foreach (var payment in this.Payments)
     {
         var clonedPayment = new Payment(payment.ProductName, payment.Price);
         clonedPayments.Add(clonedPayment);
     }
     Customer cloned = new Customer(this.FirstName, this.MiddleName, this.LastName,
         this.ID, this.Mail, this.MobilePhone, this.PermanentAddress, this.CustomerType, clonedPayments);
     return cloned;
 }
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] states = new string[n];
            for (int line = 0; line < n; line++)
            {
                states[line] = Console.ReadLine();
            }

            //string[] states = new string[n];
            //states[0] = "1011111";

            List<int> nums = new List<int>();
            nums.Add(GetNum(states[0]));
            int zeroIndex = states[0].IndexOf("0");
            while (zeroIndex != -1)
            {
                states[0] = states[0].Remove(zeroIndex, 1);
                states[0] = states[0].Insert(zeroIndex, "1");
                nums.Add(GetNum(states[0]));
                zeroIndex = states[0].IndexOf("0");
            }
            Console.WriteLine(nums.Count);
            if (n < 2)
            {
                foreach (int ele in nums)
                {
                    Console.WriteLine(ele);
                }
            }
            else
            {
                int k = nums.Count;

                int[] array = new int[k];
                int[] possible = nums.ToArray();
                Combinations(array, 0, possible, 0, k);
            }
        }
        static void Main(string[] args)
        {
            double n = double.Parse(Console.ReadLine());
            string input = "";

            List<string> list = new List<string>();
            int plus1 = 0;
            while (input != "End of the league.")
            {
                plus1++;
                input = Console.ReadLine();
                if (input != "End of the league.")
                {
                     list.Add(input);
                }
            }
            double money = (n * (plus1-1)) * 1.94;
            Console.WriteLine("{0:0.00}lv.",money);

            List<string> winners = new List<string>();
            string myStr = "";
            for (int i = 0; i < list.Count; i++)
            {
                myStr = Regex.Match(list[i], @"\d+").Value;
                if (myStr == "")
                {
                    myStr = "3";
                }

                int myInt = 0;
                myInt = Convert.ToInt32(myStr);

                if (myInt == 1)
                {
                    string firstWord = list[i].Split(' ').FirstOrDefault();
                    winners.Add(firstWord + " - 3 points.");
                    string lastWord = list[i].Split(' ').LastOrDefault();
                    winners.Add(lastWord + " - 0 points.");
                }
                else if (myInt == 2)
                {
                    string lastWord = list[i].Split(' ').LastOrDefault();
                    winners.Add(lastWord + " - 3 points.");
                    string firstWord = list[i].Split(' ').FirstOrDefault();
                    winners.Add(firstWord + " - 0 points.");
                }
                else if (myInt == 3)
                {
                    string firstWord = list[i].Split(' ').FirstOrDefault();
                    winners.Add(firstWord + " - 1 points.");
                    string lastWord = list[i].Split(' ').LastOrDefault();
                    winners.Add(lastWord + " - 1 points.");
                }
            }

            winners.Sort();
            for (int i = 0; i < winners.Count; i++)
            {
                winners[i] = winners[i];

                string newValue = Regex.Replace(winners[i], "([a-z])([A-Z])", "$1 $2");
                Console.WriteLine(newValue);
            }
        }