title: ATM Account Homework (Classes, Textfiles, Objects)
body: <p>I am completely lost. Our homework assignment is to:</p>
  
  <ol>
  <li>Create an ATM Program that asks a user for their name and pin</li>
  <li>Program will loop through asking user if they want to check balance, withdraw, deposit, or exit. You exit the loop when user selects exit. The initial balance is $10,000</li>
  <li>Create a text file that records all transactions. First 2 lines of the file should be the User's name and Pin</li>
  <li>Create a class called which includes the <strong>init</strong> and <strong>str</strong> functions to display info from the user(deposit, check balance, withdraw)</li>
  <li>Program needs to read from the file and create an object. The fields for the object are the name, pin, and balance.
  6.If the pin number and the name they provide to not match the name and pin number for the BAcc object the program will end.  Otherwise you can proceeded to make as many transactions as you want updating the file
  7.Errors must by handled using try: blocks!  This includes both invalid data entry and insufficient funds on a withdraw.</li>
  </ol>
  
  <p>This is the code I have right now, it doesn't do much but I just need a way to connect it. </p>
  
  <pre><code>accountfile=open("ATMACC.txt", "a")
  name=input("What is your name? ")
  pin=input("What is your Pin #? ")
  accountfile.write("Name: " + name + "\n" + "PIN: " + pin + "\n")
  USER_BALANCE = 10000
  class BankAcc(object):
      def __init__(self,name,pin,balance):
          name = self.name
          pin = self.pin
          10000 = self.balance
      def __str__(self):
          return "Bank Account with Balance {}".format(self.name,self.balance)
      def checkbalance(self):
          print(self)
      def deposit(self,amount):
          self.amount += amount
      def withdraw(self,amount):
          if self.balance &gt; amount:
              self.balance -= amount
          else:
              raise ValueError
  while True:
      answer=input("Would you like to deposit, withdraw, check balance, or exit? ")
      if answer=="deposit" or answer== "Deposit":
          x= input("How much would you like to deposit? ")
          USER_BALANCE += float(x)
          print ("Your new balance is: $" + str(USER_BALANCE))
          accountfile.write("\n" + "Deposit of $" + x + "." + " " + "Current balance is $" + str(USER_BALANCE))
          continue
      elif answer== "withdraw" or answer== "Withdraw":
          y= input("How much would you like to withdraw? ")
          if float (y)&lt;=USER_BALANCE:
              USER_BALANCE -= float(y)
              print ("Your new balance is: $" + str(USER_BALANCE))
              accountfile.write("\n" + "Withdraw of $" + y + "." + " " + "Current balance is $" + str(USER_BALANCE))
              continue
          else:
              print ("Cannot be done. You have insufficient funds.")
      elif answer== "check balance" or answer== "Check Balance":
          print ("$" + str(USER_BALANCE))
      elif answer== "exit" or answer== "Exit":
          print ("Goodbye!")
          accountfile.close()
          break
      else:
          print ("I'm sorry, that is not an option")
  </code></pre>
  
  <p>Please help. I know this is a complete mess but any help would be greatly appreciated.</p>