Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Rolling Ball
aquarium 1.1
3d 1st-person shooter
Attr
Valentina Spider 1.0
MediaPlayer Xtra
XTRA dmmXSC - a client for XML Socket Server
MostFramesScript
Parse CSV File
simFile Xtra
MediaMacros Xtras Mall
 

 

 

Behavior Compound Interest

Added on 5/27/2001

 

Compatibilities:
behavior D6_5 D7 D8 D8_5 Mac PC Shockwave

Rating:

Author: KurtKoenig (website)

This behavior calculates the interest on your savings over a number of years,and shows the amount after each year...

Download PC Source    Download Mac Source
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--   Compound Interest
--
--   This behavior calculates the interest on your savings over a number of years,
--   and displays the amount after each year...
--  
--   Kurt * Belgium                        2001
--
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------

-- variables are: A = Nr of years, B = Startamount,
-- I = Interest rate, E = Final amount after Nr of years

global A, B, I, E  

-- First the mousedown handler to clear
-- the previous contents of the output field on mousedown
-- (so it becomes more visible that the field is cleared each time,
-- if you use (member "Output").text = "" in a moviescripts
-- on startmovie handler, the field will be empty each time
-- the movie starts...

on mousedown
  (member "Output").text = ""
end mousedown

-- On mouseup, the new calculation is made
-- In Belgium the used formula for compound
-- Interest = E = (B * (1 + float(I)/ 100)),
-- the same formula is used in other country's to(I think...)
-- to show the result for the last year only
-- you have to use: power (E = (B * (1 + float(I)/ 100)), A)
-- (might be a small diversion in syntax, I didn't try this...)

on mouseup
  (member "Output").text = ""
  the floatprecision = 2
  B = (member "C.I") . text
  A = (member "Years") . text
  I = (member "InterestRate") . text.float
  
  repeat with Ix =  1 to A
    
    E = (B * (1 + float(I)/ 100))
    B = E
    put E&&"after"&&Ix&&"years." into (member "Output").line[Ix]
    
  end repeat
  
  clearglobals
  
end mouseup


  

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail