PYTHON CODE PLEASE!!!

9.14 Store Account Make sure to put the main section of your code in the following if block: Type code for classes here if ma

Initializes attributes with parameters. Do not create default values. A user must specify arguments in the call to create an

print deposits(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It prints

generate_report(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It genera

(5) If an invalid choice is made by the user, display the following message and then display the menu again. Invalid input TR

9.14 Store Account Make sure to put the main section of your code in the following if block: Type code for classes here if main “: name Type main section of code here (1) Build the Transaction class with the following specifications: Attributes date (str) type (str description (str) amount (float) Constructor Initializes attributes with parameters. Do not create default values. A user must specify arguments in the call to create an instance. Customize the class by implementing the str__ method. print(trans) where trans is an instance of the Transactions class should print a transaction like the following: Date: 01/11/17, Description: pants, Amount: $40.00 (2) Create the following functions- they are not part of any class. print_number_of_transactions(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It prints the number of transactions. Ex. of print number_of_transactions(list of_trans) output Number of transactions: 12 print expenses(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It prints the list of transactions that are expenses. Ex. of print expenses(list_of_trans) output: Expenses: Date: 01/10/17, Description: rent, Amount: $500.00 Date: 02/10/17, Description: rent, Amount: $500.00 Date: 03/10/17, Description: rent, Amount: $500.00 Total Expenses: $1500.00 print deposits(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It prints the list of transactions that are deposits. Ex. of print_deposits(list_of_trans) output: Deposits: Date: 01/06/17, Description: shirt, Amount: $60.00 Date: 01/11/17, Description: pants, Amount: $40.00 Date: 01/14/17, Description: socks, Amount: $10.00 Date: 02/17/17, Description: skirt, Amount: $30.00 Date: 02/19/17, Description: shirt, Amount: $60.00 Date: 02/23/17, Description: pants, Amount: $40.00 Date: 03/12/17, Description: shirt, Amount: $60.00 Date: 03/14/17, Description: shirt, Amount: $60.00 Date: 03/26/17, Description: pants, Amount: $40.00 Total Deposits: $400.00 print_balance(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It prints the account balance. If the balance is below zero it prints the additional warning message “In danger of going out of business!” Ex. of print_balance(list_of_trans) output: Balance: $-1100.00 In danger of going out of business! generate_report(list_of_trans) This function has a parameter that is a list of instances of the Transactions class. It generates a report “report.txt. Ex. of generate_report(list_of_trans) – file “report.txt is created an contains the following: TRISH’S STORE Number of transactions: 12 Balance: $-1100.00 In danger of going out of bus iness! (3) In the main section of your code, read in the file transactions.txt and create a list of transactions. (Instances of the transaction class) (4) In the main section of your code, create a menu like the following: TRISH’S STORE 1. Print total number of transactions 2. Print expenses 3. Print deposits 4. Print account balance 5. Generate report 6. Quit Enter choice (1/2/3/4/5/6) : (5) If an invalid choice is made by the user, display the following message and then display the menu again. Invalid input TRISH’S STORE 1. Print total number of transactions 2. Print expenses 3. Print deposits 4. Print account balance 5. Generate report 6. Quit Enter choice (1/2/3/4/5/6):



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *