
-----------------------------------
umaster
Thu Jun 07, 2007 7:20 pm

Bank Machine Program: variable has no value
-----------------------------------
kk i need to figure this out by tonight or i am sooo done; i get 10% off my mark in computers. Anyways, when i run my program it says that my main variable: PINBalance has no value. Though when i look over the code it seems to have no reason for the variable to be empty. I am working with external files to save the back account PIN numbers and balance. Here is the code. Also this is whats in GaryPINBalance.txt:

2571
500000
7958
10000
1008
100800

any help would be greatly appreciated thx  :) 


var PINBalance : array 1..2,1..200 of string
var PINBalanceDraft:array 1..200 of string
var PINbalance : array 1..2,1..200 of real
var overdraft: array 1..2,1..200 of string
var balancetrue : array 1..200 of boolean
var enterpin : int
var answer : string
var enterpinstr : string
var counter : int := 0
var counter2 : int:=0
var position : int := 0
var counter5 :int:=1
var space:int
var stringarray : array 1..200 of string
var intlength : array 1..200 of int
var counter3 : int:=0
var column : int := 1
var action : array 1..5 of int
var account : array 1..2,1..200 of string
var account2 : array 1..200 of real
var account3 : array 1..200 of string
var error : int:=1
var number :int
var option : string
var check :int:=0
var opval : boolean := false
var filenumber : int
var filenumber2 : int
var PINtrue:boolean:=false

for o:1..200
balancetrue(o) := false
end for

account3(1) := "WD"
account3(2) := "DEP"
account3(3) := "BILL"
account3(4) := "ACC"

open : filenumber,"GaryPINBalance.txt",get
loop
    counter := counter+1
    counter2:=counter2+1
    get : filenumber, PINBalance(column,counter)
    if column = 1
    then
    column := 2
    elsif column = 2
    then
    column :=1
    end if
    exit when eof (filenumber)
end loop
close : filenumber

open : filenumber2, "GaryPINBalanceDraft.txt", get
loop
    counter3 := counter3 + 1
    get : filenumber2, PINBalanceDraft(counter3)
    exit when eof (filenumber2)
end loop
close : filenumber2

% function WD : real
% for i:1..200
% if balancetrue(i) = true and account(1,i) = "WD"
% then
% PINBalance(2,i):= realstr(strreal(PINBalance(2,i))-strreal(account(2,i)),0)
% end if
% end for
% result WD
% end WD

check := counter2 div 2

% procedure accountacc
% for i:1..counter5
% stringarray(i):= account(2,i) 
% intlength(i):= length(stringarray(i))
% end for
% for i:1..200
% if space < intlength(i)
% then
% space := intlength(i)
% end if
% end for
% put "****************Account Activities****************"
% for i:1..2
% if PINbalance(2,i) > 0
% then
% Text.Colour (green)
% put "Opening Balance":30,"$",PINbalance(2,i):space:2
% Text.Colour (black)
% elsif PINbalance(2,i)  0
% then
% Text.Colour (green)
% put "Closing Balance":30,"$",PINbalance(2,i):space:2
% Text.Colour (black)
% elsif PINbalance(2,i)  0 
% then 
% Text.Colour (green) 
% put "Opening Balance":30,"$",PINbalance(2,i):space:2 
% Text.Colour (black) 
% elsif PINbalance(2,i)  0 
% then 
% Text.Colour (green) 
% put "Closing Balance":30,"$",PINbalance(2,i):space:2 
% Text.Colour (black) 
% elsif PINbalance(2,i) 