Program.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Задание_1;
  9. namespace Задание1
  10. {
  11. internal class Program
  12. {
  13. const double minDeposit = 49999.99;
  14. const double maxDeposit = 1000000.00;
  15. static void Main(string[] args)
  16. {
  17. double[] summa = new double[0];
  18. double[] proccent = new double[0];
  19. double[] dohod = new double[0];
  20. decsion(ref summa, ref proccent, ref dohod);
  21. }
  22. static void decsion(ref double[] summa, ref double[] procent, ref double[] dohod) // Метод решение
  23. {
  24. Bank bank = new Bank();
  25. for (double i = minDeposit; i < maxDeposit; i += 50000)
  26. {
  27. Array.Resize(ref procent, procent.Length + 1);
  28. procent[procent.Length - 1] = bank.GetProcent(i);
  29. Array.Resize(ref summa, summa.Length + 1);
  30. summa[summa.Length - 1] = i;
  31. }
  32. for (int j = 0; j < summa.Length; j++)
  33. {
  34. Array.Resize(ref dohod, dohod.Length + 1);
  35. for (int i = 1; i <= 12; i++)
  36. {
  37. if (i % 3 == 0) procent[j] += 0.005;
  38. if (i != 12) bank.GetSumma(ref dohod[dohod.Length - 1], summa[j], procent[j]);
  39. }
  40. }
  41. double max = 0;
  42. double sum = 0;
  43. for(int i = 0; i < dohod.Length; i++)
  44. {
  45. if (dohod[i] > max)
  46. {
  47. max = dohod[i];
  48. sum = summa[i];
  49. }
  50. }
  51. Console.WriteLine("Наибольший доход " + max + " при стартовом вкладе" + sum);
  52. }
  53. }
  54. }