예제 #1
0
        private void CalculateFutureBalance()
        {
            Console.Write("Skriv in startsumma: ");
            decimal currentBalance = decimal.Parse(Console.ReadLine());

            Console.Write("Skriv in ränta i procent: ");
            decimal interest = decimal.Parse(Console.ReadLine().Replace(',', '.')) / 100;

            Console.Write("Skriv in hur mycket du planerar att sätta in per månad: ");
            decimal monthlySavings = decimal.Parse(Console.ReadLine());

            Console.Write("Skriv in antal år du tänkt spara: ");
            int numberOfYears = int.Parse(Console.ReadLine());


            List <string> yearByYear = SparRobot.CalculateFutureBalance(currentBalance, interest, monthlySavings, numberOfYears);

            foreach (var year in yearByYear)
            {
                Console.WriteLine(year);
            }
            Console.WriteLine("Press ENTER to continue: ");
            Console.ReadLine();
            Run();
        }
예제 #2
0
        private void CalculateFutureBalanceAuto(decimal currentBalance, decimal interest)
        {
            List <string> yearByYear = SparRobot.CalculateFutureBalance(currentBalance, interest, 0, 40);

            foreach (var year in yearByYear)
            {
                Console.WriteLine(year);
            }
        }