Computer Science 111 – Fundamentals of Programming I Programming Project 10 Due date: 12 Noon, Friday, December 4 (Tuesday labs) 12 Noon, Monday, December 8 (Thursday lab) In this project, you will read and modify some Python classes. All of the files that you need are in the project10 directory in Handouts. Part I The file bank.py contains the SavingsAccount and Bank classes discussed in lectures. Open bank.py with IDLE and review the code for the SavingsAccount class and the testAccount function. Press function-5 to load the module into the shell and notice the outputs. The methods deposit and withdraw work fine if the amount argument is valid, but produce erroneous results otherwise. Your job in this first part is to fix these methods so that they return the appropriate error messages if the amount argument is invalid. You should see these messages displayed in the shell when you run the program again. Part II Open bank.py with IDLE and review the code for the Bank class and the createBank function. Comment out the call of testAccount in the main function and press function-5 to load the module into the shell. Then run the following lines of code in the shell: bank = createBank(10) print(bank) bank.computeInterest() print(bank) bank.getKeys() Now try to get an account from the bank, using its get method with the name and pin of a customer contained therein. Make a deposit into this account, and then print the bank again, to verify the update to its state. Finally, try to remove this account by running the bank’s remove method. 2 Note that getKeys returns an empty list. This method and the remove method are unfinished in the Bank class. Your job in this part is to complete these two methods and test them to verify that they work correctly. Part III Open bank.py with IDLE and uncomment the code in the main function below the call of testAccount. Press function-5 to load the module into the shell and note the outputs. Then run the following lines of code in the IDLE shell: bank = createBank(10) print(bank) bank.save("bank.dat") Check your current working directory to verify that it now contains the bank.dat file. Try to open it with gedit and view its contents. This is a file of account objects, as discussed in lecture. Now, return to the IDLE shell and run main(fileName = "bank.dat") This should now load the file into a new Bank object and print its contents. Finally, read carefully the code for the __init__ and save methods in the Bank class. Part IV Open atm.py with IDLE and study the code for the ATM class and the main function carefully. This module runs a GUI-based ATM application. Press function-5 to load the module into the shell and note the outputs. Try logging in with the credentials of an existing account, logging out, and logging in with a different account. Then close the window and run main("bank.dat") This should open the ATM on the bank that you saved in Part III. Now return to the code for the ATM class and note that the methods getBalance, deposit, and withdraw have yet to be completed. That’s your job in this part; be sure to run the program again to test these methods thoroughly (including the error conditions on the inputs). 3 Part IV (Extra credit: 10 points) Open bankmanager.py with IDLE and study the code for the BankManager class and the main function carefully. This module runs a GUI-based application to manage the bank. Press function-5 to load the module into the shell. Then run main("bank.dat") to load the bank from previous sessions. Try navigating through the accounts, updating an account with a new balance, removing an account or two, and computing interest. Management would like you to add a new button called Find account to the user interface. When the user clicks this button, the application pops up consecutive prompter boxes for the name and pin (consult the breezypythongui site for details on prompter boxes). The application then creates a key from these data and attempts to find the index of the key in the bank’s list of keys. If successful, the application uses the index to navigate to the desired account and update the view with its information. Otherwise, the application displays “No such account” in the status field. Turn in your project10 directory.