home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 November / pcwk_11_98a.iso / Wtestowe / Money99 / money99.1 / life / logic.js < prev    next >
Encoding:
Text File  |  1998-07-25  |  1.6 KB  |  46 lines

  1. var sto = parent.data
  2.  
  3. var yrs = sto.yrs
  4. var onetimevalue = sto.funeral + sto.finalc + sto.estate + sto.mort + sto.debt + sto.college + sto.special
  5. var shortfall = (sto.exp * 0.8) - sto.pay - sto.ss
  6. var livingValue = shortfall * yrs
  7. var totalassetsValue = sto.ins + sto.assets
  8. var totalValue = onetimevalue + livingValue - totalassetsValue
  9.  
  10. var totalAdvice = ''
  11. if ( totalValue > 0 ) 
  12. {
  13.     totalAdvice = "To ensure your family's continued well-being, you should have an <b>additional " + intToDollarStr( totalValue ) + "</b> in life insurance coverage."
  14. }
  15. else
  16. {
  17.     totalAdvice = "<b>No, </b>you have more than enough coverage for your family's needs."
  18. }
  19.  
  20. var oneTimeAdvice = "One-time expenses add up to " + intToDollarStr( onetimevalue )
  21.  
  22.  
  23. var shortfallAdvice = ''
  24. if ( shortfall > 0 )
  25. {
  26.     shortfallAdvice = "Your family will experience an income shortfall of " + intToDollarStr( shortfall ) + " annually for " + yrs + " years after your death."
  27. }
  28. else if ( shortfall < 0 )
  29. {
  30.     shortfallAdvice = "However, your family will earn " + intToDollarStr( Math.abs( shortfall ) ) + " more than they need annually for " + yrs + " years after your death."
  31. }
  32. else if ( shortfall == 0 )
  33. {
  34.     shortfallAdvice = "Your family will earn exactly what they need to live on for " + yrs + " years after your death."
  35. }
  36.  
  37. var assetsAdvice = ''
  38. if ( totalassetsValue > 0 )
  39. {
  40.     assetsAdvice = "It is assumed that insurance and other existing assets totaling " + intToDollarStr( totalassetsValue ) + " will be used to mitigate your family's loss."
  41. }
  42. else
  43. {
  44.     assetsAdvice = "There are no other assets to help mitigate your family's loss."
  45. }
  46.