Dec 112017
Mortgage cost analysis with full BASIC source, this is very helpful.
File MORTCOST.ZIP from The Programmer’s Corner in
Category BASIC Language
Mortgage cost analysis with full BASIC source, this is very helpful.
File Name File Size Zip Size Zip Type
MORTCOST.BAS 20224 5989 deflated
MORTCOST.DOC 15488 6105 deflated
TPCREAD.ME 199 165 deflated

Download File MORTCOST.ZIP Here

Contents of the MORTCOST.DOC file



--Compares the total costs of different mortgages,
including so called flexible mortgages.

--Provides the cost of the loan for each year of the loan.

--Provides you with information on the tax benefits
you will get from the loan.

--Helps you to decide how many years long to make the loan.

--Shows you the effect of inflation when financing a home.

--Helps you decide if a mortgage should be refinanced at a
lower interest rate.


In recent years, banks and savings and loans developed new plans
to make loans more attractive (and more confusing) with lower
initial interest rates that could then increase or decrease as
money market conditions changed. Because of this, it is
misleading to compare the loans between two banks by looking only
at the initial interest rate.

Also, even with fixed rate loans, when interest rates fall it
would be helpful to know when to refinance the loan at a lower
interest rate, and how long it would take to recover the costs of

For most people, the home purchase is the biggest expense of
their lifetimes. MORTCOST provides a way to minimize that
expense by studying these and other problems in detail.


MORTCOST computes the monthly loan payment, the principal and
interest paid, and principal remaining. In addition, it
estimates the approximate income tax deduction that you will be
able to take on the interest portion of your mortgage payments.

A key feature of the program is the ability to change the
interest rate and other inputs at any point during the loan.
This permits analysis of variable interest rate or "flexible"
mortgages, something that few if any other mortgage analysis
programs can do.

Additional costs can be entered for any year in the loan, such as
the direct costs that the loan company charges (usually
non-deductible for tax purposes, i.e. title searches and attorney
fees), and up front interest charges payable at loan closing
(often referred to as "points" or "closing costs").

After calculating and displaying these values for each year of
the loan, MORTCOST produces several sums.

The total of interest payments, interest points, and direct costs
are added together. From that sum, the tax deduction for the
interest can be subtracted, and a net cost is accumulated from
the start of the loan to any year during the loan.

In addition, the program calculates total cash flow out per year,
which is the cost listed above, plus the payment of principal on
the loan. This sum is also totalled from the start to any given

Finally, if you estimate what you think inflation will do in
future years, the program will show the results from above as
"Adjusted for Inflation." See section on "HOW TO INTERPRET THE
RESULTS" for an explaination of the benefits of this feature.


MORTCOST will help you when choosing a home mortgage, or even
some types of car loans. We have found that some mortgage plans
can cost many thousands of dollars more than others.

We encourage you to copy, use, and help distribute this program
to others provided that the following two restrictions be
followed. (1) This documentation file must accompany any copy of
the program code, and (2) any distribution and use must be
non-commercial in nature. Business use of the program or resale
for profit may only be done with the expressed written permission
of the authors listed below. We retain all rights of Copyright

We hope that this program helps you in your decisions and saves
you money. If you find it worthwhile, we ask that you consider
sending us $5-10 to help compensate for our programming time and
direct costs of distribution. By publishing the software in this
manner, more people are exposed to it, and everyone can decide
for themselves if it is of value. Our hope is that those who
really benefit from MORTCOST will consider this nominal cost to
be a bargain.

Please send to:

Terry and Joann Quinn
RR # 4
Metamora, IL 61548


Although the program will prompt you for inputs, a few notes may

When the program refers to the "year" of the loan, it assumes
that the loan is written at the start of year 1. A 30 year loan
then runs to year 30. Calendar years like 1986 are not used.

Percentages are enterred as numbers greater than 1. For example an
11.5% loan is entered as 11.5. Monthly loan payments are
assumed in the calculations.

If you want an entry to change during the loan period, enter only
the year when the change starts. MORTCOST will fill in the
numbers for the years in-between. For example, if the loan had
an 11.5% interest rate to start, but changes to 14% after the
completion of 3 years, you would enter 11.5 for the starting loan
interest rate, then enter 4 for the new year, then 14 for the new
loan percentage to be in effect from then on.

Once you have completed inputs, you can then compute the loan,
display the results to the screen, and/or send them to a printer.
All of the input values are held in memory, and by typing single
letter commands from the menu, you can change one or more inputs,
(V)iew the inputs to see if they are correct, and then
re-calculate. This makes it easy to test for different

Current tax laws permit a deduction for loan interest charges.
If you itemize deductions on your income tax, this deduction
reduces your total loan cost. The amount of deduction will vary,
depending on your tax bracket, length of loan, interest rates,
and points. The calculated cost of the loan includes a
subtraction of the tax deduction from your total loan cost. This
section can be easily skipped if you don't want to include the
tax benefit.

To compute the tax savings, the program asks you to input your
tax bracket. If you are unfamiliar with what your income tax
bracket is, keep in mind that it is the percentage that you would
be taxed on any new money that you would make over your current
income. If you have to use tax rate schedules when you do your
income tax, it is the percentage figure shown on the tax rate
schedule for your taxable income bracket.

If you use tax tables, find your taxable income in the tables,
and see how much more tax you would pay if your income was $1000
more than now. Divide the amount of additional tax you would
have to pay (not the total tax) by 10, and that is your bracket,
expressed as a percentage.

If you have had your tax prepared, the preparer can easily tell
you what your bracket is.


A. COMPARING LOANS. By looking at the total loan cost figures
output by the program, you can compare two or more loans to find
the least expensive. This would be the correct way to analyze a
loan if you expected to live in the house until the loan was paid
off. The total loan cost includes the repayment of principal.

Sometimes, you may not be planning to use the entire life of the
mortgage. For example, you might expect to be transfered by your
company in 5 years, and sell the house then. In this case, you
should look at the costs of the loan at 5 years, not the total

In this latter case, the portion of your monthly payments that
have gone to reduce the loan principal will be returned when you
sell the house. Therefore, you may want to look just at the
cumulative interest, points, and direct costs column when
comparing the loans.

B. HOW LONG SHOULD A LOAN BE. Generally, the length of loan
will be based on a number of factors, such as how much you can
afford on monthly payments, how long you expect to live in the
house, whether you will be retired when the loan expires, etc.
But the cost of the loan is also a factor. Some loans have
higher initial closing costs or "points", but with lower nominal
interest rates. MORTCOST helps you compare those differences, by
simply running the analysis on each loan and comparing the loan
costs. See the next section on inflation for more information on

inflation enters the picture, think of the older folks who are
paying less than $100 on their home mortgage payments. We envy
them now, but when they purchased their homes, those payments
were just as tough as today's higher monthly payments. In the
ensuing years, however, inflation has decreased the value of the
money, taking the "pain" out of the house payment.

With inflation, as the loan gets older, it takes less "real
money" to make the house payment. By showing the total cost of
the loan and other summaries in dollars "Adjusted for Inflation",
you can see what the costs are expressed in "today's dollars."

Using this feature, MORTCOST can help you decide between a short
vs a long mortgage or loan. Occasionally, but certainly not
always, depending on inflation and the loan interest rate
schedule, a long loan may be better for your circumstances. Even
though you may pay more total dollars on the long loan, the real
value of the money that you pay may be less than with a shorter

analysis of your existing loan. Then run the loan that you are
considering refinancing to with all of the closing costs
included. If you have held the existing loan for, say five
years, and you are now starting year six, compare the costs of
year 6 on the old loan with year 1 of the new loan. The new one
will probably be higher if there are closing costs. But keep
summing the years, 6+7 vs 1+2, then 6+7+8 vs 1+2+3 and so on,
(cumulative cost columns helpful here) until the lower interest
new loan becomes less expensive. You can then decide if
refinancing will pay off quickly enough for you.

NOTE: If you are going to compare numbers "adjusted for
inflation" when doing this analysis, be sure to enter 0 inflation
for the non-overlap years, (would be first 5 years of the
original loan in this example), so that the inflation effect is
started at the same actual year for both loans.


With an analysis tool such as this, your results depend in part
on the assumptions that you make. For example, it is obviously
guesswork as to what inflation will be like in the future.

Since it is so easy to change these assumptions and rerun the
program, it makes sense to experiment. Run your loan candidates
at a conservative estimate and a liberal estimate. You may find
that some plans will look good or bad no matter what assumptions
you make.


So that it doesn't write a book, MORTCOST only calculates these
answers on an annual basis. It does not give a month by month
computation, but it does show the monthly payment in any given
year. You will find, however, that this is still sufficient to
tell the difference between various loan plans.

Most flexible mortgages are set up so that if an adjustment in
interest rates occurs, the loan payment will be recomputed based
the principal remaining at the time of the adjustment. MORTCOST
can calculate this type of loan.

A few flexible mortgages are written so that the payment remains
constant no matter what. Our opinion is that these mortgages are
relatively dangerous, because if there is a large increase in the
interest rate, you can actually lose equity in your home if the
payment cannot meet the higher interest. MORTCOST does not
analyze this type of flexible mortgage.

The only limits on the dollar size of the loan are primarily
related to output display. Loan principals up to $10 million
dollars should be no problem, and higher amounts will run
depending on the length of the loan and interest rates. Watch
for funny characters on the output (like % signs) if you are
running these very large loans.

During initialization, the program sizes itself to be able to
handle loans with periods of up to 60 years in length.


We have obviously tried to insure that the formulas used
throughout the program are correct. Since, however, we do not
have control over the use and distribution of the program, or the
interpretation of the results, we provide no guarantee as to the
accuracy or correctness of the program or its output and we
assume no liability for its use or misuse.


(Note: The remaining part of the documentation is only needed if
you are having trouble getting the program to run on your
computer, want to modify it to speed it up, or want to improve
accuracy slightly at the expense of speed).

Software: A BASIC interpreter capable of handling "PRINT USING"
statements is needed to run MORTCOST. The program was written on
Microsoft BASIC, and tested successfully on IBM BASIC.

Hardware: CRT should have 80 column by 24 line display. If
number of lines are less than 24, the program will run, but some
screen displays may scroll off. An 80 column printer is optional.

MORTCOST needs a total memory somewhere between 32 and 64K to
run, depending on the BASIC being used. If you run out of
memory, the program can be re-dimensioned so that it will only
calculate for 30 years instead of 60, which will free up about
2K. To do this, change the variable name SIZE found early in the
program listing from 60 to 30. If the program is still too big,
either the printer output or screen display routines can be
removed to further shrink the program about 2K.

Clear screen command: This change will speed up the program a
little. So that MORTCOST as distributed could be used on
different computers, a subroutine is used to clear the screens by
scrolling off previous images. Some computers (like the IBM PC,
for example) have relatively slow video drivers, and the clear
screen subroutine can be annoying. If your computer has a
special clear screen command, change the command at line 170 to
replace the existing command line. Some examples are given

Current line:

For IBM and Radio Shack:

For Kaypro, Osborne, or others responding to ADM-3A commands:

For Apple:

If yours is different, just insert your clear screen command, and
follow with :RETURN

Accuracy: Certain outputs may differ from some other programs by
a few cents (or a few dollars if you are working with very, very
large loans). The reason is that to conserve memory and increase
speed, single precision variables were used in MORTCOST. The
errors will be nearly insignificant as a percentage of total loan
cost. If this concerns you, however, the program can be modified
by adding the following line at the start of the program to
convert variables to double precision:


(Caution: This little change will swallow an additional 4K of
memory and it slows the program down a lot).

Microsoft is a registered trademark of the Microsoft Corporation.
IBM and IBM PC are registered trademarks of International
Business Machines Corporation.

 December 11, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>