public void SavingEntireTakeHomePay_ShouldEqual100PercentSavingsRate() { const int takeHomePay = 50000; const int preTaxContributions = 12000; var savingsRateService = new SavingsRateService(preTaxContributions, takeHomePay, takeHomePay); var savingsRate = savingsRateService.Calculate(); Assert.AreEqual(1m, savingsRate); }
private static void CalculateSavingsRate() { //-> Savings Rate //Total Savings (pre & post tax) / (After tax takehome pay + pre-tax contributions) Console.WriteLine("*** Calculating Savings Rate ***"); Console.WriteLine("How much is your total take home pay, per paycheck?"); var takeHomePay = decimal.Parse(Console.ReadLine()); Console.WriteLine("How much do you contribute to retirement (pre-tax, including employer match) per paycheck?"); var preTaxContributions = decimal.Parse(Console.ReadLine()); Console.WriteLine("How much do you contribute to retirement (after tax) per paycheck?"); var postTaxContributions = decimal.Parse(Console.ReadLine()); var savingsRateService = new SavingsRateService(preTaxContributions, takeHomePay, postTaxContributions); var savingsRate = savingsRateService.Calculate() * 100; Console.WriteLine($"Your current savings rate is {decimal.Round(savingsRate, 2)}%"); }