Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local acct = ""
- local interAcct = ""
- local name = ""
- local interName = ""
- local pass = ""
- local interPass = ""
- local muny = ""
- local interMuny = ""
- local inp = ""
- local acct2 = ""
- local name2 = ""
- local pass2 = ""
- local muny2 = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- write("Please place your ")
- term.setTextColor(colors.red)
- write("Electronic Banking Card")
- term.setTextColor(colors.white)
- print(" in the disk drive.")
- if disk.isPresent("left")==true then
- if fs.exists("disk/acc") then
- term.clear()
- term.setCursorPos(1,1)
- print("Please enter the account you wish to access.")
- write("Account: ")
- acct = read()
- if fs.exists("disk/acc/"..acct..".txt") then
- h = fs.open("disk/acc/"..acct..".txt", "r")
- name = h.readLine()
- pass = h.readLine()
- muny = h.readLine()
- h.close()
- term.clear()
- term.setCursorPos(1,1)
- write("Please enter your password: ")
- inp = read("*")
- if inp==pass then
- while inp~="" do
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome, "..name..". Your account currently has $"..muny..". What would you like to do?")
- print("a) Withdraw from internal account")
- print("b) Deposit from external account")
- print("c) Make an internal payment to another account")
- print("d) Create a new internal account")
- print("e) Create a new external account")
- print("f) Exit")
- inp = read()
- if inp=="a" then
- term.clear()
- term.setCursorPos(1,1)
- print("Please state the internal account you wish to access: ")
- write("Internal Account: ")
- interAcct = read()
- if fs.exists("acc/"..interAcct..".txt") then
- iA = fs.open("acc/"..interAcct..".txt", "r")
- interName = iA.readLine()
- interPass = iA.readLine()
- interMuny = iA.readLine()
- iA.close()
- term.clear()
- term.setCursorPos(1,1)
- write("Please enter this account's password: ")
- inp = read("*")
- if inp==interPass then
- term.clear()
- term.setCursorPos(1,1)
- print("This account belongs to "..interName..", and currently has $"..interMuny..". How much money would you like to withdraw from this internal account?")
- write("$")
- inp = read()
- if inp-0 > interMuny-0 then
- term.clear()
- term.setCursorPos(1,1)
- print("The internal account accessed has insufficient funds.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif inp-0 == 0 or inp-0 < 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("You must withdraw $0.01 or more.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- else
- muny = (muny-0) + (inp-0)
- interMuny = (interMuny-0) - (inp-0)
- local w = fs.open("disk/acc/"..acct..".txt", "w")
- w.writeLine(name)
- w.writeLine(pass)
- w.writeLine(muny)
- w.close()
- local iAW = fs.open("acc/"..interAcct..".txt", "w")
- iAW.writeLine(interName)
- iAW.writeLine(interPass)
- iAW.writeLine(interMuny)
- iAW.close()
- term.clear()
- term.setCursorPos(1,1)
- print("Transaction Complete.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Access Denied.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That internal account does not exist.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="b" then
- term.clear()
- term.setCursorPos(1,1)
- print("Please enter the account that you would like to deposit money into.")
- write("Internal Account: ")
- interAcct = read()
- if fs.exists("acc/"..interAcct..".txt") then
- iA = fs.open("acc/"..interAcct..".txt", "r")
- interName = iA.readLine()
- interPass = iA.readLine()
- interMuny = iA.readLine()
- iA.close()
- term.clear()
- term.setCursorPos(1,1)
- print("This account belongs to "..interName..". Would you like to deposit to this account?")
- print("a) Yes.")
- print("b) No.")
- inp = read()
- if inp=="a" then
- term.clear()
- term.setCursorPos(1,1)
- print("How much money would you like to deposit into the account?")
- write("$")
- inp = read()
- if inp-0 == 0 or inp-0 < 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("You must deposit $0.01 or more.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif inp-0 > muny-0 then
- term.clear()
- term.setCursorPos(1,1)
- print("You have insufficient funds.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- muny = (muny-0) - (inp-0)
- interMuny = (interMuny-0) + (inp-0)
- w = fs.open("disk/acc/"..acct..".txt", "w")
- w.writeLine(name)
- w.writeLine(pass)
- w.writeLine(muny)
- w.close()
- iAW = fs.open("acc/"..interAcct..".txt", "w")
- iAW.writeLine(interName)
- iAW.writeLine(interPass)
- iAW.writeLine(interMuny)
- iAW.close()
- print("Transaction complete.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="b" then
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That was not an option.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That internal account does not exist.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="c" then
- term.clear()
- term.setCursorPos(1,1)
- print("From which internal account would you like to make the payment?")
- write("Internal Account: ")
- interAcct = read()
- if fs.exists("acc/"..interAcct..".txt")==true then
- iA = fs.open("acc/"..interAcct..".txt", "r")
- interName = iA.readLine()
- interPass = iA.readLine()
- interMuny = iA.readLine()
- iA.close()
- term.clear()
- term.setCursorPos(1,1)
- write("Please enter your password: ")
- inp = read("*")
- if inp==interPass then
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome, "..interName..". You have $"..interMuny..". What account would you like to make a payment to?")
- write("Internal Account: ")
- local interAccte = read()
- if fs.exists("acc/"..interAccte..".txt") then
- iAe = fs.open("acc/"..interAccte..".txt", "r")
- local interNamee = iAe.readLine()
- local interPasse = iAe.readLine()
- local interMunye = iAe.readLine()
- iAe.close()
- term.clear()
- term.setCursorPos(1,1)
- print("This account belongs to "..interNamee..". Is this who you would like to pay?")
- print("a) Yes.")
- print("b) No.")
- inp = read()
- if inp=="a" then
- term.clear()
- term.setCursorPos(1,1)
- print("How much would you like to pay?")
- write("$")
- inp = read()
- if inp-0 > interMuny-0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Your account has insufficient funds.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif inp-0 == 0 or inp-0 < 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("You may only make payments of $0.01 or more.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- interMuny = (interMuny-0) - (inp-0)
- interMunye = (interMunye-0) + (inp-0)
- iAW = fs.open("acc/"..interAcct..".txt", "w")
- iAW.writeLine(interName)
- iAW.writeLine(interPass)
- iAW.writeLine(interMuny)
- iAW.close()
- iAWe = fs.open("acc/"..interAccte..".txt", "w")
- iAWe.writeLine(interNamee)
- iAWe.writeLine(interPasse)
- iAWe.writeLine(interMunye)
- iAWe.close()
- print("Transaction complete.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="b" then
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That was not an option.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That internal account does not exist.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Access Denied.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That internal account does not exist.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="d" then
- term.clear()
- term.setCursorPos(1,1)
- print("What would you like to call this account?")
- write("Account name: ")
- interAcct = read()
- if fs.exists("acc/"..interAcct..".txt")==false then
- h = fs.open("acc/"..interAcct..".txt", "w")
- term.clear()
- term.setCursorPos(1,1)
- write("Enter a password: ")
- interPass = read("*")
- term.clear()
- term.setCursorPos(1,1)
- print("How much money would you like to open this account with?")
- write("$")
- inp = read()
- if inp-0 < 0 or inp-0==0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Accounts can only be opened with $0.01 and over.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif inp-0 > muny-0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Your account has insufficient funds.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- interMuny = (inp-0)
- muny = (muny-0) - (inp-0)
- h.writeLine(name)
- h.writeLine(interPass)
- h.writeLine(interMuny)
- h.close()
- h = fs.open("disk/acc/"..acct..".txt", "w")
- h.writeLine(name)
- h.writeLine(pass)
- h.writeLine(interMuny)
- print("Internal Account Created.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("This account already exists.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="e" then
- term.clear()
- term.setCursorPos(1,1)
- print("What would you like to call this account?")
- interAcct = read()
- if fs.exists("disk/acc/"..interAcct..".txt")==false then
- term.clear()
- term.setCursorPos(1,1)
- write("Enter a password: ")
- interPass = read("*")
- term.clear()
- term.setCursorPos(1,1)
- print("How much money would you like to open this account with?")
- write("$")
- inp = read()
- if inp-0 < 0 or inp-0 == 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Accounts can only be opened with $0.01 or more.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- elseif inp-0 > muny-0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Your account has insufficient funds.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- else
- term.clear()
- term.setCursorPos(1,1)
- muny = (muny-0) - (inp-0)
- interMuny = (inp-0)
- h = fs.open("disk/acc/"..acct..".txt", "w")
- h.writeLine(name)
- h.writeLine(pass)
- h.writeLine(muny)
- h.close()
- h = fs.open("disk/acc/"..interAcct..".txt", "w")
- h.writeLine(name)
- h.writeLine(interPass)
- h.writeLine(interMuny)
- h.close()
- print("External Account Created.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("This account already exists.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- elseif inp=="f" then
- term.clear()
- term.setCursorPos(1,1)
- print("Ejecting Electronic Banking Card.")
- disk.eject("left")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- break
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That was not an option.")
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Access Denied.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("That account does not exist.")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("This is not a banking card.")
- sleep(5)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- sleep(1)
- end
- end
Add Comment
Please, Sign In to add comment