1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Задание_1;
- namespace Задание1
- {
- internal class Program
- {
- const double minDeposit = 49999.99;
- const double maxDeposit = 1000000.00;
- static void Main(string[] args)
- {
- double[] summa = new double[0];
- double[] proccent = new double[0];
- double[] dohod = new double[0];
- decsion(ref summa, ref proccent, ref dohod);
- }
- static void decsion(ref double[] summa, ref double[] procent, ref double[] dohod) // Метод решение
- {
- Bank bank = new Bank();
- for (double i = minDeposit; i < maxDeposit; i += 50000)
- {
- Array.Resize(ref procent, procent.Length + 1);
- procent[procent.Length - 1] = bank.GetProcent(i);
- Array.Resize(ref summa, summa.Length + 1);
- summa[summa.Length - 1] = i;
- }
- for (int j = 0; j < summa.Length; j++)
- {
- Array.Resize(ref dohod, dohod.Length + 1);
- for (int i = 1; i <= 12; i++)
- {
- if (i % 3 == 0) procent[j] += 0.005;
- if (i != 12) bank.GetSumma(ref dohod[dohod.Length - 1], summa[j], procent[j]);
- }
- }
-
- double max = 0;
- double sum = 0;
- for(int i = 0; i < dohod.Length; i++)
- {
- if (dohod[i] > max)
- {
- max = dohod[i];
- sum = summa[i];
- }
- }
- Console.WriteLine("Наибольший доход " + max + " при стартовом вкладе" + sum);
- }
- }
- }
|