private void txtPrincipal_TextChanged(object sender, EventArgs e) { try { txtStandingCharge.Text = Convert.ToString(Convert.ToDouble(txtPrincipal.Text) * (ld.StandingCharge / 100)); loan.StandingCharge = Convert.ToDecimal(txtPrincipal.Text) * (decimal)(ld.StandingCharge / 100); si.Time = (int)numericUpDown1.Value; si.Principal = Convert.ToDecimal(txtPrincipal.Text); si.Calculate(); } catch { } }
public void Calculate_CentPrincipal_ReturnTotalAmountRoundCent() { double principal = 1500.50; double interestPercent = 4.3; int years = 4; double dollars = SimpleInterest.Calculate(principal, interestPercent, years); Assert.That(dollars, Is.EqualTo(1758.59)); }
public void Calculate_PrincipalAndRateAndYears_ReturnTotalAmount() { double principal = 1500.00; double interestPercent = 4.3; int years = 4; double dollars = SimpleInterest.Calculate(principal, interestPercent, years); Assert.That(dollars, Is.EqualTo(1758.00)); }
static void Main(string[] argd) { SimpleInterest oSI = new SimpleInterest(5000, 12.5, 5); CompoundInterest oCI = new CompoundInterest(5000, 12.5, 5, 3); oSI.Calculate(); oCI.Calculate(); CompareInterest compare = new CompareInterest(); compare.Compare(oSI, oCI); Console.WriteLine(); Console.WriteLine("Press any key"); Console.ReadLine(); }
static void Main(string[] args) { SimpleInterest oSI = new SimpleInterest(5000, 15.5, 3); oSI.Calculate(); oSI.Display(); oSI = null; CompoundInterest oCI = new CompoundInterest(5000, 15.5, 3, 4); oCI.Calculate(); oCI.Display(); oCI.DeductServiceCharge(250); oCI.Calculate(); oCI.Display(); oCI = null; Console.WriteLine("Press a key..."); }