Skip to content

Commit

Permalink
Fixed deposit and withdraw functions.
Browse files Browse the repository at this point in the history
They still do not save into the database.
  • Loading branch information
Otakar Andrysek authored and Otakar Andrysek committed Jun 29, 2016
1 parent 364a943 commit dbffabb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Program Files/ATM.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def checkBalance(cardNumber,userRow):
balance = row[2]
return balance
print("ERROR 1: BALANCE READ ERROR")
sys.exit()


# Deposit function
Expand All @@ -64,15 +65,17 @@ def deposit(cardNumber, userRow, balance):


# Withdraw function
def withdrawal(cardNumber, userRow):
balance = 50 # Make sure to get this from card numbers
money_taken = int(input("How much money do you wish to withdraw? "))
if balance - money_taken >= 0:
balance -= money_taken
def withdrawal(cardNumber, userRow, balance):
withdrawalValue = float(input("How much money do you wish to withdraw? "))
if float(balance) - withdrawalValue >= 0:
balance = float(balance) - float(withdrawalValue)
print("Withdrawal successful.")
print("Your new balance is " + str(balance) + " dollars.")
print("Your new balance is: $%s" %balance)
return balance
else:
print("Error: Not enough balance.")
print("ERROR 2: Not enough money to withdraw.")
return float(balance)


# Program Begins (main menu and GUI)
print ("**********************************************")
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ This is an ATM program that is currently being developed. The purpose of this pr
# Current Features
- Deposit
- Withdraw
- View Ballance
- View Balance
- Check card number and pin against bank databse

# Future Features
- Save withdraw / deposit into database
- Compound intrest over time
- Open new account
- ??? (Add any future features here)
Expand Down

0 comments on commit dbffabb

Please sign in to comment.