Facebook
From Trivial Echidna, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 58
  1. static class Finance
  2.     {
  3.         public static double ObliczFV(double PV, double r, double n)
  4.         {
  5.             return PV * (1 + r * n);
  6.         }
  7.         public static double ObliczPV(double FV, double r, double n)
  8.         {
  9.             return FV / (1 + r * n);
  10.         }
  11.  
  12.         /*
  13.         StackOverFlowException
  14.         *wyjątek generowany w przypadku przepełnienia stosu wykonywania
  15.         *ponieważ zawiera zbyt wiele wywołań metod zagnieżdżonych.
  16.         *
  17.         *Klasa ta nie może być dziedziczona
  18.         */
  19.  
  20.     }
  21.    
  22.    
  23.    
  24.   class Program
  25.     {
  26.         static void Main(string[] args)
  27.         {
  28.             double r = 0.12; //stopa procentowa
  29.             double n = 1.5; //liczba lat
  30.             double PV = 15;
  31.             double FV = 10;
  32.  
  33.             Console.WriteLine("FV:  " + Math.Round(Finance.ObliczFV(PV, r,n), 2).ToString());
  34.  
  35.             Console.WriteLine("PV:  " + Math.Round(Finance.ObliczPV(FV, r, n), 2).ToString());
  36.  
  37.         }
  38.     }