Question
class Account: def __init__(self, sOwner, iID, fBalance): pass def getOwner(self): pass def getID(self): pass def getBalance(self): pass def setOwner(self, sOwner): pass def setID(self, iID): pass
class Account: def __init__(self, sOwner, iID, fBalance): pass def getOwner(self): pass def getID(self): pass def getBalance(self): pass def setOwner(self, sOwner): pass def setID(self, iID): pass def setBalance(self, fBalance): pass def deposit(self, amount): pass def withdraw(self, amount): pass def printAccountInfo(self): pass
class CheckingAccount(Account): def __init__(self, sOwner, iID, fBalance, iTF): pass def getTransactionCount(self): pass def getTransactionFee(self): pass def setTransactionCount(self, iTC): pass def setTransactionFee(self, iTF): pass def deposit(self, amount): pass def withdraw(self, amount): pass def deductFees(self): pass class SavingsAccount(Account): def __init__(self, sOwner, iID, fBalance, fIR): pass
def getInterestRate(self): pass def setInterestRate(self, fIR): pass def withdraw(self, amount): pass
def applyInterest(self): pass def main(): pass
############################################################ # Below are the tests for getOwner() def test1(): pass # This comment explains what test1() is testing for, and is followed by code def test2(): pass # This comment explains what test2() is testing for, and is followed by code
# Below are the tests for setOwner() def testN(): pass # This comment explains what testN() is testing for, and is followed by code
############################################################ if __name__ == "__main__": main()
Project Details Here is a UML class diagram of the three classes that you will develop. You'll note that some of the methods in the child classes override methods in the parent class. In these cases, you should use super to access the common functionality from the parent class. Account owner: String id: int balance: float getOwner() -> string getID() -> int getBalance() -> float setOwner(string) setID(int) setBalance(float) deposit(float) withdraw(float) printAccountInfo() A Checking Account transaction Count: int transaction Fee: int getTransaction Count()-> int getTransaction Fee()-> int set Transaction Count(int) set Transaction Fee(int) deposit(float) withdraw(float) deductFees() SavingsAccount interestRate: float getinterestRate()-> float setlnterestRate(float) withdraw(float) applyinterest() The following are descriptions of the classes and methods contained in these classes (you should also create constructors): Account This is the base class representing a bank account. It contains the basic data for an account (ID, owner, balance) and methods to access those attributes, as well as methods for adding and removing money and checking a balance. getowner(): Returns the owner of the account. get 100: Returns the ID number of the account. .getBalance(): Returns the current balance in the account. . setowner(): Updates the owner of the account from the method argument. SetIDO : Updates the ID number of the account from the method argument. .setBalance(): Updates the balance in the account from the method argument. deposit(): Takes the method argument and adds it to current account balance. withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below 0, a warning message is printed and an extra $5 penalty is deducted from the account. printAccountInfo() : Prints the owner, ID, and balance of the account. Checking Account This bank permits customers to sign up for checking accounts. But banks need to make money too, so this account comes with a few twists. In addition to inheriting all of the attributes of the Account class, this checking account class also stores a count of operations and an accompanying operation fee. The function descriptions below explain these in more detail. Additionally, the constructor for this class should initialize self._transactioncount to 0. . getTransactioncount(): Returns the number of transactions since the last fee. .getTransactionFee(): Return the amount charged for transaction fees. .setTransactioncounto: Updates the number of transactions since the last fee. .setTransactionFee(): Updates the transaction fee amount. . deposit(): Takes the method argument and adds it to the current account balance. Also adds 1 to the number of transactions since the last fee, and calls the deductFees function. withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below O, a warning message is printed and an extra $5 penalty is deducted from the account. Also adds 1 to the number of transactions since the last fee, and calls the deductFees() function. . deductFees(): If there have been 5 transactions since the last fee, deduct the Transaction Fee from the account balance and reset the counter to 0. SavingsAccount This bank also permits customers to sign up for savings accounts. In addition to inheriting all of the attributes of the Account class, this savings account class also stores an interest rate which gives customers some additional cash, just for being a customer. . get InterestRate(): Returns the interest rate associated with the account. set InterestRate(): Updates the interest rate associated with the account. . withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below 0, a warning message is printed and an extra $5 penalty is deducted from the account, and the interest rate is also reduced to 0. applyInterest(): When this function is called the interest rate is applied to update the balance (e.g., a 0.05 interest rate means that 5% of the current balance is added to the account balance). Test-Driven Development Process One goal of this assignment is to practice your test-driven development strategies. Rather than writing your methods from no basis, or developing these methods by trial and error, you should create test cases that may pass or fail these rules. Remember the five phases that were discussed earlier in the semester: 1. Write a test in response to a requirement. 2. Run the full set of tests (the new one will most likely fail). 3. Write code that will cause the new text to pass. 4. Run the full set of tests to verify that your new code didn't break anything else. 5. Refactor your code and repeat. This project requires you to create functions that incorporate console output. You don't need to worry about testing for the correct printed output, but you do need to write tests to verify the accuracy of the returned output. Submission Details To complete this activity, you must submit the following file to Web-CAT: classyBanking.py, which contains 20 methods as described above, as well as your collection of tests. A template file is provided for you at the top of this page. At least 38 tests, and almost certainly more, 2 for each of the 19 functions (skipping the printAccountinfo() function). Project Details Here is a UML class diagram of the three classes that you will develop. You'll note that some of the methods in the child classes override methods in the parent class. In these cases, you should use super to access the common functionality from the parent class. Account owner: String id: int balance: float getOwner() -> string getID() -> int getBalance() -> float setOwner(string) setID(int) setBalance(float) deposit(float) withdraw(float) printAccountInfo() A Checking Account transaction Count: int transaction Fee: int getTransaction Count()-> int getTransaction Fee()-> int set Transaction Count(int) set Transaction Fee(int) deposit(float) withdraw(float) deductFees() SavingsAccount interestRate: float getinterestRate()-> float setlnterestRate(float) withdraw(float) applyinterest() The following are descriptions of the classes and methods contained in these classes (you should also create constructors): Account This is the base class representing a bank account. It contains the basic data for an account (ID, owner, balance) and methods to access those attributes, as well as methods for adding and removing money and checking a balance. getowner(): Returns the owner of the account. get 100: Returns the ID number of the account. .getBalance(): Returns the current balance in the account. . setowner(): Updates the owner of the account from the method argument. SetIDO : Updates the ID number of the account from the method argument. .setBalance(): Updates the balance in the account from the method argument. deposit(): Takes the method argument and adds it to current account balance. withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below 0, a warning message is printed and an extra $5 penalty is deducted from the account. printAccountInfo() : Prints the owner, ID, and balance of the account. Checking Account This bank permits customers to sign up for checking accounts. But banks need to make money too, so this account comes with a few twists. In addition to inheriting all of the attributes of the Account class, this checking account class also stores a count of operations and an accompanying operation fee. The function descriptions below explain these in more detail. Additionally, the constructor for this class should initialize self._transactioncount to 0. . getTransactioncount(): Returns the number of transactions since the last fee. .getTransactionFee(): Return the amount charged for transaction fees. .setTransactioncounto: Updates the number of transactions since the last fee. .setTransactionFee(): Updates the transaction fee amount. . deposit(): Takes the method argument and adds it to the current account balance. Also adds 1 to the number of transactions since the last fee, and calls the deductFees function. withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below O, a warning message is printed and an extra $5 penalty is deducted from the account. Also adds 1 to the number of transactions since the last fee, and calls the deductFees() function. . deductFees(): If there have been 5 transactions since the last fee, deduct the Transaction Fee from the account balance and reset the counter to 0. SavingsAccount This bank also permits customers to sign up for savings accounts. In addition to inheriting all of the attributes of the Account class, this savings account class also stores an interest rate which gives customers some additional cash, just for being a customer. . get InterestRate(): Returns the interest rate associated with the account. set InterestRate(): Updates the interest rate associated with the account. . withdraw(): Takes the method argument and subtracts it from the account balance. If the balance falls below 0, a warning message is printed and an extra $5 penalty is deducted from the account, and the interest rate is also reduced to 0. applyInterest(): When this function is called the interest rate is applied to update the balance (e.g., a 0.05 interest rate means that 5% of the current balance is added to the account balance). Test-Driven Development Process One goal of this assignment is to practice your test-driven development strategies. Rather than writing your methods from no basis, or developing these methods by trial and error, you should create test cases that may pass or fail these rules. Remember the five phases that were discussed earlier in the semester: 1. Write a test in response to a requirement. 2. Run the full set of tests (the new one will most likely fail). 3. Write code that will cause the new text to pass. 4. Run the full set of tests to verify that your new code didn't break anything else. 5. Refactor your code and repeat. This project requires you to create functions that incorporate console output. You don't need to worry about testing for the correct printed output, but you do need to write tests to verify the accuracy of the returned output. Submission Details To complete this activity, you must submit the following file to Web-CAT: classyBanking.py, which contains 20 methods as described above, as well as your collection of tests. A template file is provided for you at the top of this page. At least 38 tests, and almost certainly more, 2 for each of the 19 functions (skipping the printAccountinfo() function)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started