It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Python Forum

ATM MACHINE HELP

ATM MACHINE HELP

Postby muddpigeon on Fri Apr 20, 2007 12:20 pm

I HAVE THIS PROGRAM TO DO FOR UNI BUT I AM TOTALLY STUMPED WITH IT I WONDERD IF ANY ONE CAN HELP ME AT ALL OR IF YOU HAVE DONE ANYTHIN LIKE THIS BEFORE GIVE ME AN IDEA OF WHERE TO GO NEXT THE CODE IS AS FOLLOWS.
Code: Select all
import pickle
f= open ("pin.pck", "w")
pickle.dump(1234, f)
pickle.dump([1,2,3,4], f)
f.close()

#Pin Validation
def pin():
   f=open("pin.pck", "r")
   x=pickle.load(f)
   print
   print " ***Welcome to the bellco banking system***"
   print "============================================="
   print "Please insert your card"
   print ""
   print "Card Accepted"
   print ""
   pin = raw_input ("Please insert your pin number to the keypad: ")
   print "=============================================="

   #Checks if pin is within range of 1000 to 9999
   while True:
      if pin >= 1000:
         print "Pin accepted"
      if pin <= 9999:
         print "Pin accepted"
         print
      if pin == x:
         print "Valid Pin"
         print
      if pin != x:
         print "Invalid Pin"
         print
         pin()
         break
      else:
         print "Invalid Pin"
         pin()
         break

#Create Menu
def createmenu():
   print " ***Welcome to Bank ATM*** "
   print "=================================="
   print " Please select one of the below "
   print " 1 Withdrawal only"
   print " 2 Withdrawal With Statement"
   print " 3 Statement only"
   print " 4 Quit"
   print "=================================="

#Statement Procedure
def statement():
   print "Your balance is $" #balance details
   print
   print "Thank you for using this Bank ATM"
   print "=================================="

#Withdrawal Procedure
def withdrawal():
   print "================================"
   print " Please select one of the below "
   print " 1 $50"
   print " 2 $100"
   print " 3 $150"
   print " 4 $200"
   print "================================="

   amount= raw_input ("Please make your selection:")
   print "===================================="
   while True:
      if amount == "1":
         print "You have chosen to withdraw $50"
         print
         print "Please take your cash"
         print "================================="
         break
      #Insert coding to remove cash from balance
      elif amount == "2":
         print "You have chosen to withdraw $100"
         print
         print "Please take your cash"
         print "==================================="
         break
      #Insert coding to remove cash from balance
      elif amount == "3":
         print "You have chosen to withdraw $150"
         print
         print "Please take your cash"
         print "================================="
         break
      #Insert coding to remove cash from balance
      elif amount == "4":
         print "You have chosen to withdraw $200"
         print
         print "Please take your cash"
         print "================================="
         break
      else:
         print "Invalid Selection - Re-enter"
         withdrawal()
         break
#Menu Options
def selectoption():
   keypadinput = raw_input ("Enter your selection: ")
   while True:
      if keypadinput == "1":
         print
         print "You have chosen to make a withdrawal"
         withdrawal()
         break
      elif keypadinput == "2":
         print
         print "You have chosen to make a withdrawal withdrawal with a statement"
         withdrawal()
         statement()
         break
      elif keypadinput == "3":
         print
         print "You have chosen to print a statement"
         statement()
         break
      elif keypadinput == "4":
         print
         print "Thank you for using this Bank ATM"
         break
      else:
         print "Invalid Selection"
         selectoption()
         break
#Initiate Program
pin()
createmenu()
selectoption()
muddpigeon
 
Posts: 0
Joined: Fri Apr 20, 2007 12:17 pm

Who is online

Users browsing this forum: No registered users and 0 guests