Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Banking_Percent
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.WriteLine("Введите строку вида (исходная сумма процентная ставка срок вклада)");
  11.             string consoleInput = Console.ReadLine();
  12.             Console.WriteLine(Calculate(consoleInput));
  13.         }
  14.  
  15.         public static double Calculate(string userInput)
  16.         {
  17.             List<string> bankingItems = new List<string>(
  18.                 userInput.Split(new string[] { " " }, StringSplitOptions.None));
  19.             double originMoney = Convert.ToDouble(bankingItems[0]);
  20.             double durationMonths = Convert.ToDouble(bankingItems[1]);
  21.             double yearRate = Convert.ToDouble(bankingItems[2]);
  22.             //double monthRate = yearRate / 12.0;
  23.  
  24.             return originMoney * Math.Pow(1 + yearRate / (12 * 100), durationMonths);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement