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 (red)
% put "Opening Balance":30,"$",PINbalance(2,i):space:2
% Text.Colour (black)
% end if
% end for
% for i:1..counter5
% put account3(i):30,"$",account2(i):space:2
% end for
% for i:1..200
% if 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 (red)
% put "Closing Balance":30,"$",PINbalance(2,i):space:2
% Text.Colour (black)
% end if
% end for
% end accountacc
loop
put "Please enter your PIN number:"
get enterpin
enterpinstr := intstr(enterpin)
number:=0
for i:1..check
if enterpinstr = PINBalance(1,i+number)
then
PINtrue:= true
balancetrue(i) := true
end if
number := number+1
end for
if PINtrue not= true and error not= 3
then
put "Sorry that PIN is invalid please enter it again"
error:= error+1
end if
if error = 3
then
put "Sorry that was your last try to enter a PIN"
end if
exit when PINtrue = true or error = 3
end loop
if error = 3
then
Error.Halt ("Invalid PIN number entered 3 times")
end if
for h:1..200
if balancetrue(h) = true
then
position := h
end if
end for
loop
put "There are four options you may choose from:"
put "- Withdraw (WD)"
put "- Deposit (DEP)"
put "- Pay a Bill (BILL)"
put "- Acount Activities (ACC)"
put "Please enter the abreviation of the option you want, located in the brackets"
put "(case sensetive, all capitals):"
loop
get option
for i:1..4
if option = account3(i)
then
opval := true
end if
end for
if opval = false
then
put "Sorry you have not entered a valid option please re enter the option you want"
end if
exit when opval = true
end loop
if option = "WD"
then
account (1,counter5) := "WD"
counter5 := counter5 +1
put "Your current balance is: ",PINBalance(2,position)
put "How Much Would You Like To Withdraw?"
get account (2,counter5)
elsif option = "DEP"
then
counter5 := counter5 +1
account (1,counter5) := "DEP"
put "Your current balance is: ",PINBalance(2,position)
put "How Much Would You Like To Deposit?"
get account (2,counter5)
elsif option = "BILL"
then
counter5 := counter5 +1
account (1,counter5) := "BILL"
put "Your current balance is: ",PINBalance(2,position)
put "How Much Is The Bill You Must Pay?"
get account (1,counter5)
elsif option = "ACC"
then
put "YAY"
%accountacc
end if
counter5 := counter5+1
put "Are there any more transactions?(Y/N)"
get answer
exit when answer = "N" or answer = "n"
end loop
|