DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦49e3fb921⟧ TextFile

    Length: 6528 (0x1980)
    Types: TextFile
    Names: »MONEY.IPF«

Derivation

└─⟦65142c8de⟧ Bits:30004652 KnowledgeMan vers. 1.07h
    └─ ⟦this⟧ »MONEY.IPF« 

TextFile

/**********************************************************************

     This program is meant to provide you with an example of how 
     Knowledgeman  can  be  used  to  dynamically  construct   a 
     spreadsheet.   It is for demonstration purposes ONLY and no 
     guarantee is made for its fitness in any way.

**********************************************************************/



clear

/*****
     Define a form for the intial that will put an explanation of the
     program on the screen.
 *****/
form intro 
 AT 1,28 PUT "THE TIME VALUE OF MONEY"  WITH "R" 
 AT 3,7 PUT "As we all know, money is not free.  Borrowing money today requires that"  
 AT 4,4 PUT "we pay back not only the amount  that was borrowed, but also an additional "  
 AT 5,4 PUT "amount  representing  the interest  charges over  the loan  period.   This"  
 AT 6,4 PUT "program uses a KnowledgeMan  spreadsheet  to help  us compute some  useful "  
 AT 7,4 PUT "values of different  cash flows over  time at a known  interest rate.   By"  
 AT 8,4 PUT "giving KnowledgeMan the interest rate,  the period of time,  and a present"  
 AT 9,4 PUT "and/or  future amount  of money,  it  will  automatically compute,  at the "  
 AT 10,4 PUT "given interest rate, the"  
 AT 12,7 PUT "FUTURE VALUE, at a point in time represented by the given number of"  
 AT 13,9 PUT "periods in the future, of the present amount invested now."  
 AT 14,7 PUT "PRESENT AMOUNT that must be invested now to obtain the given future"  
 AT 15,9 PUT "amount at the point in time represented by the given number of"  
 AT 16,9 PUT "periods in the future."  
 AT 17,7 PUT "FUTURE AMOUNT that will have accumulated at the end of the given"  
 AT 18,9 PUT "period of time by investing the given present amount each period."  
 AT 19,9 PUT "This is referred to as the future value of an annuity."  
 AT 20,7 PUT "PRESENT AMOUNT which must be invested in order to receive the given"  
 AT 21,9 PUT "annuity each period for the given number of periods in the future."  
 AT 23,24 PUT "Press"  
 AT 23,31 PUT "ANY KEY" WITH "B" 
 AT 23,40 PUT "to start program"  
 AT 1,1 TO 24,80 PUT "FRBO" 
 AT 2,3 TO 24,78 PUT "FOBR" 
endform 

putform intro; at 23,57


/*****
     Load an empty 17 x 6 spreadsheet from the context file "ss14x6.icf".
     This file was created by:
               (1) Invoking KnowledgeMan
               (2) Executing the command: CALC 17,6
               (3) Leaving the CALC mode by executing: ØBYE
               (4) Saving the current context with: SAVE TO ss14x6
 *****/
load ss17x6 with "C"


/*****
     Define a macro that raises X to the power of Y.
 *****/
macro XtoY exp(Y*ln(X))


/*****
     Set spreadsheet foreground and background colors.
 *****/
e.forg="O"
e.bacg="R"

form pause
 at 22,15 to 22,60 put "FOBR"
 at 22,22 put "C O M P U T I N G .... Please wait" with "B"
endform


/*****
     Give new widths to some of the spreadsheet columns
 *****/
calc width #a5 
calc width #b8        
calc width #c20
calc width #e18
calc width #f11


/***** 
     Set the VALUE of several cells to string constants to serve as titles
     and comments for the spreadsheet display.   
 *****/
#a1="-----------------------------------------------------------------------"
#a2="  $ $ $      T h e   T i m e   V a l u e   o f   M o n e y      $ $ $"
#a3="-----------------------------------------------------------------------"
#a5="   Present Amount/Annuity: P/A ="
#b6="       Interest Rate:  I  ="
#b7="   Number of Periods:  N  ="
#b8="       Future Amount:  F  ="

#a10="At the given Interest Rate (I), the"
#a11="  FUTURE VALUE of Present Amount (P) in N periods:"
#a12="  PRESENT VALUE of Future Amount (F) obtained in N periods:"
#a13="  FUTURE VALUE of Annuity (A) obtained in each of N periods:"
#a14="  PRESENT AMOUNT needed to obtain Annuity (A) for N periods:"
#d16="Enter ØØCOMPUTE to obtain answers"
#d17="Enter ØØSTOP    to exit spreadsheet"


/***** 
     Define pictures for the data entry and display cells. 
 *****/	
calc using " ddddd" #d5
calc using " dd.dd" #d6
calc using "    dd" #d7
calc using "dddddd" #d8
calc using "dddddd" #f11 to #f14
	
	
	
/*****
     Initialize the data entry cells. 
 *****/
#d5=0; #d6=0; #d7=0; #d8=0

	

/****************************************************************************
                        CELL DEFINITIONS
 ****************************************************************************/

/*****
     Put up the 'COMPUTING' message at the beginning of each ØCOMPUTE.
 *****/	
cell #a1 = putform pause; at 21,40


/***** 
     Setup variables for computation.
 *****/ 
cell #f10 = i=abs(#d6)/100;Ø
            p=abs(#d5);Ø
            a=p;Ø
            n=abs(#d7);Ø
       	    f=abs(#d8)
	
	
/*****
     Future Value of Present Amount.
 *****/	
cell #f11 = calc =#f11;Ø
            X=1+i;Ø
            Y=n;Ø
            p*XtoY
	
	
/*****	
     Present Value of Future Amount.
 *****/
cell #f12 = calc =#f12;Ø
            X=1+i;Ø
            Y=n;Ø
            f*1/XtoY


/*****
     Future Value of Annuity.
 *****/
cell #f13= calc =#f13;Ø
           j=0; ans=0;Ø
           X=1+i;Ø
           while j<n do;Ø
              Y=j;Ø
	      ans=ans+XtoY;Ø
	      j=j+1;Ø
	   endwhile;Ø
	   a*ans


/*****
     Present Value of Annuity. 
 *****/
cell #f14= calc =#f14;Ø
           j=1; ans=0;Ø
           X=1+i;Ø
           while j<=n do;Ø
	      Y=j;Ø
	      ans=ans+1/XtoY;Ø
	      j=j+1;Ø
	   endwhile;Ø
	   a*ans;Ø
	   calc =#d5


/****************************************************************************
                     DEFINE CELL ATTRIBUTES	
 ****************************************************************************/

calc style color "BOFA" #f11 to #f14
calc style color "BOFA" #d5 to #d8
calc activate #f11 to #f14
calc activate #d5 to #d8

calc conceal #f10 to #f14
calc conceal #d5 to #d8

calc =#d5        !Put cell cursor in cell #d5

calc border      !Turn off the spreadsheet border.  This is only done for
                 !asthetic reasons.  It has no other effect.

/*****
     After the user has read the initial screen, pressing any key will 
     put KnowledgeMan in the spreadsheet mode.
 *****/
wait
calc

«eof»