當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Simulation.futureValueWithContribution方法代碼示例

本文整理匯總了TypeScript中src/service/simulation.Simulation.futureValueWithContribution方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Simulation.futureValueWithContribution方法的具體用法?TypeScript Simulation.futureValueWithContribution怎麽用?TypeScript Simulation.futureValueWithContribution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在src/service/simulation.Simulation的用法示例。


在下文中一共展示了Simulation.futureValueWithContribution方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should be the present value of the future value of each of the asset type return rates', () => {
   let mixedAccount = new Account(1, 'Mixed account', '401k', 10000, 1200, 25, 25, 50);
   let stockPercentage = mixedAccount.stockPercentage / 100;
   let bondPecentage = mixedAccount.bondPercentage / 100;
   let cashPercentage = mixedAccount.cashPercentage / 100;
   let stockBalance = mixedAccount.balance * stockPercentage;
   let bondBalance = mixedAccount.balance * bondPecentage;
   let cashBalance = mixedAccount.balance * cashPercentage;
   let stockRetirementBalance = Simulation.presentValue(Simulation.futureValueWithContribution(stockBalance, 10, Simulation.STOCK_RETURN, mixedAccount.contribution * stockPercentage), 10, Simulation.INTEREST);
   let bondRetirementBalance = Simulation.presentValue(Simulation.futureValueWithContribution(bondBalance, 10, Simulation.BOND_RETURN, mixedAccount.contribution * bondPecentage), 10, Simulation.INTEREST);
   let cashRetirementBalance = Simulation.presentValue(Simulation.futureValueWithContribution(cashBalance, 10, Simulation.CASH_RETURN, mixedAccount.contribution * cashPercentage), 10, Simulation.INTEREST);
   let retirementBalance = Simulation.retirementBalance(mixedAccount, 10);
   let expectedRetirementBalance = stockRetirementBalance + bondRetirementBalance + cashRetirementBalance;
   expect(retirementBalance).toBeCloseTo(expectedRetirementBalance, 2);
 });
開發者ID:jasoncarreira,項目名稱:choices,代碼行數:15,代碼來源:simulation.spec.ts

示例2: describe

describe('The future value ', () => {
  let fv = Simulation.futureValueWithContribution(1000, 10, .1, 1200);
  it('is not null', () => {
    expect(fv).not.toBeNull();
  });
  it('should be greater than the current value', () => {
    expect(fv).toBeGreaterThan(1000);
  });
  it('should be the expected future value', () => {
    expect(fv).toBeCloseTo(23191.54, 2);
  });
});
開發者ID:jasoncarreira,項目名稱:choices,代碼行數:12,代碼來源:simulation.spec.ts


注:本文中的src/service/simulation.Simulation.futureValueWithContribution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。