""" atm.py Write a program to simulate an ATM machine. Store balances and account info in a file. Use objects. in class May 3 """ """ thinking ... put information in a file atm_info.txt : name, password, checking_balance, savings_balance name2, pass2, check2, save2 ... initial screen **************** IntroCS ATM ***************** Type your name to start your login : What do you want to do? 1. Withdraw cash 2. Transfer money 3. See accounts """ datafilename = 'atm_info.txt' class User: def __init__(self, name, password, checking, savings): self.name = name self.password = password self.checking = checking self.savings = savings def __str__(self): return f"User '{self.name}' check={self.checking} save={self.savings}" class ATM: def __init__(self): self.users = self.read_data_from_file() def __str__(self): result = "ATM " for user in self.users: result = result + '<' + str(user) + '> ' return result def read_data_from_file(self): """ read in the account info from a file , return list of Users """ users = [] datafile = open(datafilename) for line in datafile: (name, password, checking, savings) = line.split(',') user = User(name, password, checking, savings) # get user info users.append(user) # put into list return users def write_data_to_file(self): pass def run(self): """ main interactive loop """ while True: self.first_screen() # show first screen user = self.login() # ask for user login self.session(user) # let that user do things def first_screen(self): # display initial screen of information def login(self): # ask for username, loop through users to find this person # return the correct user def session(self, user): # give choices for what that user can do class Account: # checkings or savings ... pass def main(): atm = ATM() atm.run() #print(atm) if __name__ == '__main__': main()