Thanks, Danny. I should be able to convert it to ActionScript.

Cordially,

Kerry Thompson

> Here it is in Lingo (from my book - sorry some line breaks have come in,
I'm
> on a computer with no Director so I had to cut and paste from the
> documentation). The second function is the one you're looking for (but it
> calls the first one).
> 
> Danny
> 
>  on mortgage am, pc, pay, tp
>  --! ARGUMENTS:
> am (loan amount), pc (APR), pay (monthly payment),
>  --! tp
> (#monthly, #mixed or #yearly (default), the detail required
> for output)
>  --! RETURNS: a string giving the rate of repayment
> on a (capital and repayment) mortgage
>  set the floatprecision
> to 2 -- (ensures two decimal place output)
>  -- set the monthly
> interest, as a fraction 1+APR/1200
>  pc=1+pc/(1200.0)
> 
> i=0
>  oldam=am
>  ret=""
>  repeat while am>0
>  i=i+1
> 
> -- each month, increase the loan by the monthly interest, and
> decrease it by the fixed payment
>  am=pc*am - pay
>  if am<=0
> then
>  -- if the amount is less than or equal to zero then
> the loan has been repayed
>  put "At the end of month"&&i&&"the
> loan is $0"&return after ret
>  -- we can also calculate the
> total money paid in interest
>  put "You have paid $"&(i*pay-oldam+am)&&"in
> interest." after ret
>  am=0
>  else
>  if (i mod 12) = 0
> then tx="year"&&i/12
>  else tx="month"&&i
>  if tp=#monthly
> or (tp=#mixed and i<12) or ((i mod 12) =0) then
>  put
> "At the end of"&&tx&&"the loan is $"&am&return after ret
> 
> 
>  end if
> 
>  end if
>  end repeat
>  return ret
> end
> 
>
----------------------------------------------------------------------------
----
>  on mortgagecalc am, pc, yr
>  --!
> ARGUMENTS: am (loan amount), pc (APR), yr (number of years),
> 
> --! RETURNS: a string giving the monthly payment for a (capital
> and repayment) mortgage
> at the given APR
>  i = 1+pc/1200.0
>  mth=yr*12
>  pow=power(i,mth)
> 
> pay=am*pow*(i-1)/(pow-1)
>  put "Monthly payment is"&&pay
> 
> mortgage(am,pc,pay,#year)
> end
> 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to