Esempio n. 1
0
        public static void Main()
        {
            TypeOfClientArray AllClients = new TypeOfClientArray();
            CalculatAllPriece allPriece  = new CalculatAllPriece();
            ClientsCalculator calculator = new ClientsCalculator();
            CalculatAllPriece Privileges = new CalculatAllPriece();
            ClientsSorter     SortMax    = new ClientsSorter();
            ClientsSorter     SortMin    = new ClientsSorter();

            Console.WriteLine("Массив потреблённой клиентами энергии по убыванию:");
            printarray(SortMax.SortMax(AllClients.allclientsarray()));
            Console.WriteLine();
            Console.WriteLine("Массив величины оплаты клиентов по возрастанию:");
            printarray(SortMin.SortMin(calculator.clientscalculator()));
            Console.WriteLine();
            Console.WriteLine("Массив по типу клиентов:");
            printarray(AllClients.allclientsarray());
            Console.WriteLine();
            Console.WriteLine($"Общая сумма : {allPriece.Price(calculator.clientscalculator())}");
            Console.WriteLine();
            Console.WriteLine($"Общая сумма льгот: {Privileges.Privileges(AllClients.allclientsarray())}");
            Console.WriteLine();
        }
Esempio n. 2
0
        public int[,] clientscalculator()
        {
            int[,] allcheck = new int[4, 4] {
                { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
            };;
            int i = 0;
            int j = 0;
            TypeOfClientArray allClients = new TypeOfClientArray();

            int[,] allclient = allClients.allclientsarray();
            int n = allclient.Length / 4;

            for (; i < n; i++)
            {
                if (i == 0)
                {
                    do
                    {
                        allcheck[i, j] = allclient[i, j] * NormalPrice;
                        j++;
                    }while (j < n);
                    j = 0;
                }
                else if (i == 1)
                {
                    do
                    {
                        if (allclient[i, j] > Limitline)
                        {
                            allcheck[i, j] = (allclient[i, j] - Limitline) * LimitPrice + Limitline * NormalPrice;
                        }
                        else
                        {
                            allcheck[i, j] = allclient[i, j] * NormalPrice;
                        }
                        j++;
                    }while (j < n);
                    j = 0;
                }
                else if (i == 2)
                {
                    do
                    {
                        allcheck[i, j] = allclient[i, j] * PrivilegPrice;
                        j++;
                    }while(j < n);
                    j = 0;
                }
                else
                {
                    do
                    {
                        if (allclient[i, j] > PrivelegPrice2)
                        {
                            allcheck[i, j] = (allclient[i, j] - PrivelegPrice2) * NormalPrice;
                        }
                        else
                        {
                            allcheck[i, j] = 0;
                        }
                        j++;
                    }while (j < n);
                    j = 0;
                }
            }
            return(allcheck);
        }