\begindata{text,538270968}
\textdsversion{12}
\template{default}
\define{plus
}
\plus{


\begindata{lset,537826568}
\V 1
\begindata{lset,537827080}
\V 1
\begindata{lset,537827336}
\V 1
\begindata{cel,537827592}
\V 2
\begindata{value,537469184}
>137
\enddata{value,537469184}
10 537469184 1 0 0 0 
>OBJ< value
>VIEW< sliderV
>REF< Amount
\begindata{text,538266252}
\textdsversion{12}
[long] <min_value> (20)

[long] <max_value> (300)

[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Amount)

\enddata{text,538266252}
\enddata{cel,537827592}
0 0 0 537827592 0 0 0
>OBJ< cel
>VIEW< celview
>REF< 
\enddata{lset,537827336}
\begindata{lset,537827848}
\V 1
\begindata{lset,537828104}
\V 1
\begindata{cel,537828360}
\V 2
\begindata{value,537469440}
>48
\enddata{value,537469440}
10 537469440 1 0 0 0 
>OBJ< value
>VIEW< thumbstrV
>REF< Months
>LINK< t
\begindata{text,538265936}
\textdsversion{12}
[long] <increment> (6)

[long] <min_value> (6)

[long] <max_value> (300)

[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Months)

\enddata{text,538265936}
\enddata{cel,537828360}
0 0 0 537828360 0 0 0
>OBJ< cel
>VIEW< celview
>REF< 
\enddata{lset,537828104}
\begindata{lset,537828616}
\V 1
\begindata{cel,537828872}
\V 2
\begindata{value,537469568}
>12
\enddata{value,537469568}
10 537469568 1 0 0 0 
>OBJ< value
>VIEW< thumbstrV
>REF< Interest
>LINK< INK< t
\begindata{text,538265600}
\textdsversion{12}
[long] <increment> (1)

[long] <min_value> (5)

[long] <max_value> (20)

[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Interest)

\enddata{text,538265600}
\enddata{cel,537828872}
0 0 0 537828872 0 0 0
>OBJ< cel
>VIEW< celview
>REF< 
\enddata{lset,537828616}
2 53 0 0 537828104 537828616 0
>OBJ< 
>VIEW< 
>REF< 
\enddata{lset,537827848}
2 50 0 0 537827336 537827848 0
>OBJ< 
>VIEW< 
>REF< 
\enddata{lset,537827080}
\begindata{lset,537829128}
\V 1
\begindata{cel,538296328}
\V 2
\begindata{text,538265372}
\textdsversion{12}
\template{default}
\define{upbase

attr:[Script PreviousScriptMovement Point -15]}
\leftindent{Dear Valued Customer,

Your application for a loan of\upbase{ 
\begindata{cel,538296584}
\V 2
\begindata{value,537469696}
>0
\enddata{value,537469696}
10 537469696 1 0 0 0 
>OBJ< value
>VIEW< stringV
>REF< ShowPrincipal
>LINK< 
\begindata{text,538317740}
\textdsversion{12}
[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Principal)

\enddata{text,538317740}
\enddata{cel,538296584}
\view{celview,538296584,4,82,23} }dollars has been approved at a rate 
of\upbase{ 
\begindata{cel,538296840}
\V 2
\begindata{value,537469824}
>0
\enddata{value,537469824}
10 537469824 1 0 0 0 
>OBJ< value
>VIEW< stringV
>REF< ShowInterest
>LINK< 
\begindata{text,538316964}
\textdsversion{12}
[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Interest)

\enddata{text,538316964}
\enddata{cel,538296840}
\view{celview,538296840,5,72,25} }with repayment over a period of\upbase{ 
\begindata{cel,538297096}
\V 2
\begindata{value,537469952}
>0
\enddata{value,537469952}
10 537469952 1 0 0 0 
>OBJ< value
>VIEW< stringV
>REF< ShowMonths
>LINK< 
\begindata{text,538316168}
\textdsversion{12}
[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Months)

\enddata{text,538316168}
\enddata{cel,538297096}
\view{celview,538297096,6,78,24} }months.   Each month you will make a payment 
of 
\upbase{ \
\begindata{cel,538297352}
\V 2
\begindata{value,537470080}
>0
\enddata{value,537470080}
10 537470080 1 0 0 0 
>OBJ< value
>VIEW< stringV
>REF< Payment
>LINK< 
\begindata{text,538315596}
\textdsversion{12}
[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Payment)

\enddata{text,538315596}
\enddata{cel,538297352}
\view{celview,538297352,7,86,27} }and the total repaid to the bank over the 
lifetime of the loan will be\upbase{ 
\begindata{cel,538297608}
\V 2
\begindata{value,537470208}
>0
\enddata{value,537470208}
10 537470208 1 0 0 0 
>OBJ< value
>VIEW< stringV
>REF< Total
>LINK< t
\begindata{text,538314604}
\textdsversion{12}
[long] <bodyfont-size> (14)

[string] <bodyfont> (andysans)

[string] <label> (Total Paid)

\enddata{text,538314604}
\enddata{cel,538297608}
\view{celview,538297608,8,96,26}}.



With best wishes,


Friendly National Bunk\
}\enddata{text,538265372}
0 538265372 0 0 0 0 
>OBJ< text
>VIEW< textview
>REF< text
\enddata{cel,538296328}
0 0 0 538296328 0 0 0
>OBJ< cel
>VIEW< celview
>REF< 
\enddata{lset,537829128}
1 85 0 0 537827080 537829128 0
>OBJ< 
>VIEW< 
>REF< 
\enddata{lset,537826568}
\view{lsetview,537826568,11,464,370}
\leftindent{
}
}
\begindata{ness,537682440}
\origin{00\\31 Jul 1990 at 17:17:12 EDT\\wjh:  Fred Hansen\\00}
\template{default}
\define{sans
menu:[Font,Sans]
attr:[FontFamily AndySans Int 0]}
--edit_dollars(v) convert to a string with two digits after decimal place

--

function edit_dollars(real v)

	marker a, c

	a := textimage(round(v * 100.0))

	c := extent(previous(last(a)), last(a))

	return extent(a, start(c)) ~ "." ~ c

end function


--ipow(i, n)

--	compute i\superscript{n}

--

real function ipow(real i, integer n)

	integer j

	real v

	j := 0

	v := 1.0

	while j < n do

		j := j + 1

		v := v * i

	end while

	return v

end function


--UpdateResults()

--	Store new value in results field

--

function UpdateResults()

	integer principal, months

	real monthlyInterest, payment, totalpaid, z


	if mouseaction /= mouseleftup then 

		exit function

	end if


-- The periodic payment for

--	q periods per year

--	n years

--	i annual interest

--	P principal

-- is

--	payment = iPz/(z-1),     where  z = (1 + i/q)\superscript{nq}


	principal := value_GetValue(inset("Amount"))

	months := value_GetValue(inset("Months"))

	monthlyInterest := float(value_GetValue(inset("Interest"))) / 100.0 / 12.0

		-- divide by 100 to convert from a percentage,

		-- and then divide by 12 to get monthly interest.


	z := ipow(1.0 + monthlyInterest, months)      -- Compute  z  

	payment := float(principal * 1000) * monthlyInterest * z / (z - 1.0) 


	totalpaid := payment * float(months)

	value_SetString(inset("Payment"), edit_dollars(payment))

	value_SetString(inset("Total"), edit_dollars(totalpaid))


	value_SetString(inset("ShowPrincipal"), textimage(principal * 1000))

	value_SetString(inset("ShowInterest"),

		textimage(value_GetValue(inset("Interest"))) ~ " %")

	value_SetString(inset("ShowMonths"), textimage(months))


end function



extend "Amount"

	on mouse "any"

		dohit (currentinset, mouseaction, mousex, mousey)

		UpdateResults()

	end mouse

end extend


extend "Interest"

	on mouse "any"

		dohit (currentinset, mouseaction, mousex, mousey)

		UpdateResults()

	end mouse

end extend


extend "Months"

	on mouse "any"

		dohit (currentinset, mouseaction, mousex, mousey)

		UpdateResults()

	end mouse

end extend\
\enddata{ness,537682440}
\view{nessview,537682440,12,0,486}


-- 
\begindata{bp,537558784}
\enddata{bp,537558784}
\view{bpv,537558784,14,0,0}

-- Copyright 1992 Carnegie Mellon University and IBM.  All rights reserved.

\smaller{\smaller{-- $Disclaimer: 

-- Permission to use, copy, modify, and distribute this software and its 

-- documentation for any purpose is hereby granted without fee, 

-- provided that the above copyright notice appear in all copies and that 

-- both that copyright notice, this permission notice, and the following 

-- disclaimer appear in supporting documentation, and that the names of 

-- IBM, Carnegie Mellon University, and other copyright holders, not be 

-- used in advertising or publicity pertaining to distribution of the software 

-- without specific, written prior permission.

-- 

-- IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 

-- DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 

-- ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 

-- SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 

-- BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 

-- DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 

-- WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 

-- ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 

-- OF THIS SOFTWARE.

--  $

}}\enddata{text,538270968}
