%Variable Table
var STRmortgage, STRpayment, name, address, phonenum, yesno : string
var anykey : string (1)
var badinput := false
var interest, mortgage, payment : real
var row, col, year : int
%End Variable Table
function yearlimit () : int
var mortgage2 : real
var yearcount : int := 0
mortgage2 := mortgage + mortgage * interest - payment
yearcount += 1
loop
if mortgage2 = 0 then
exit
else
mortgage2 += mortgage2 * interest - payment
yearcount += 1
end if
end loop
result yearcount
end yearlimit
%Mortgage Chart
%Bank Name
%Mortgage Schedule for
%Year OpeningBalance InterestOwed TotalOwing Payment ClosingBalance
procedure chart % Incomplete
row := 0
col := 0
for yearcount : 1 .. 35
locate (row, col)
put year
row := row + 1
%exit when
end for
end chart
View.Set ("graphics:979;668")
%Declares and draws a background image from a separate file for the intro background
%var bgpic := Pic.FileNew ("moneyman3.jpg")
%Pic.Draw (bgpic, 0, 0, 0)
%Opening Screen
getch (anykey)
cls
%Welcoming Screen/Info Gathering PHONENUM Incomplete
loop
locate (maxrow div 2, maxcol div 2 - 5)
put "Name: " ..
get name : *
locate (maxrow div 2 + 1, maxcol div 2 - 5)
put "Address: " ..
get address : *
locate (maxrow div 2 + 2, maxcol div 2 - 5)
put "Phone Number: ( ) - " ..
get phonenum
locate (maxrow div 2 + 4, maxcol div 2 - 12)
loop
put "Is this information correct (Y/N)?" ..
get yesno
if yesno = "y" or yesno = "Y" then
cls
exit
elsif yesno = "n" or yesno = "N" then
cls
exit
else
put "Please enter Y for yes or N for no."
end if
end loop
if yesno = "y" or yesno = "Y" then
exit
end if
end loop
loop
loop
put "Enter the amount you would like to mortgage (whole numbers please)."
put "$" ..
get STRmortgage
for i : 1 .. length (STRmortgage)
if index ("0123456789", STRmortgage (i)) = 0 then
put STRmortgage ..
put " is not an acceptable number."
put "Please do not enter any letters and enter a whole number."
badinput := true
exit
end if
end for
if badinput = false then
exit
end if
badinput := false
end loop
mortgage := strreal (STRmortgage)
if mortgage > 0 and mortgage <= 100000 then
interest := 0.035
exit
elsif mortgage > 0 and mortgage <= 200000 then
interest := 0.055
exit
elsif mortgage > 0 and mortgage <= 300000 then
interest := 0.065
exit
elsif mortgage > 0 and mortgage > 300001 then
interest := 0.075
exit
else
put "You can not mortgage $0."
put ""
end if
end loop
put "Your interest rate per year is ", interest
const minpay := mortgage * interest + 1000
put "The minimum annual payment allowed is ", minpay
put "How much would you like to pay per year (Whole number please)?"
loop
get STRpayment
for i : 1 .. length (STRpayment)
if index ("0123456789", STRpayment (i)) = 0 then
put "That is not a valid payment amount."
put "Do not enter letters and please enter a whole number."
badinput := true
end if
end for
if badinput = false then
payment := strreal (STRpayment)
if yearlimit () > 30 then
put "That minimum payment is too small to pay off your mortgage in 30 years."
badinput := false
end if
if payment >= minpay and yearlimit () < 30 then
exit
elsif payment < minpay then
put "That does not meet the minimum payment requirements."
badinput := false
end if
end if
end loop
put "yay"
|