Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

URGENT PLS HELP (PYTHON LANGUAGE/RULES PROVIDED BELOW) FILE OUTPUT PROVIDED DOWN BELOW: Account moe 6 Deposit 6 10.50 Withdraw 6 100.25 Print 6 Account larry

URGENT PLS HELP (PYTHON LANGUAGE/RULES PROVIDED BELOW)

FILE OUTPUT PROVIDED DOWN BELOW:

Account moe 6 Deposit 6 10.50 Withdraw 6 100.25 Print 6 Account larry 28 Print 28 Withdraw 28 100.00 Deposit 28 10.00 Deposit 28 10.00 Withdraw 6 5.25 Account curly 42 Print 6 Print 28 Print 42

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Note: Do not use any language construct or library/module not taught in lecture sections. For this homework, that includes dictionaries, sets, lambda expressions, etc. Unsure if something is acceptable to use? Ask your professor. Tracking Financial Transactions For this homework, you will process and track a number of financial transactions which are read from an input file. The input file will contain an unknown number of lines of input, each line contains a "command" followed by additional information about the "command". The possible commands, and their additional information (parameters) are as follows. 1 An example of an input file can be found here. Note that when I grade your program, this WILL NOT BE the input file we use, but our input file will adhere to the input file description. The input file will end with an empty line. That is, each line of input in the file will have a new line (in) character at the end of the line. Note that each account number will be unique, but account names might duplicate in the input file. Input File Example Processing Each line of the input file should be read by your program. Each "Account" command should result in the creation of a new "Account" object. Each newly created "Account" object should be placed in a list (give it an appropriate name in your program, such as "account_list"). Each "Account" object should obviously store the account's name and current balance. However, it should also contain a list of transactions that were performed on the object (assuming they were valid transactions; withdrawals that can't be executed due to insufficient funds will be discarded). The transactions list should be composed of tuples with the transaction command, transaction amount, and the resulting balance after the transaction is completed. Valid "transactions" are deposit and withdrawal. Printing is not a transaction. Thus, if you were to process the above input file, and looked at the resulting "moe" account, it should be represented in your program something like this: Again, note that Moe's transaction list does not include the Withdrawal attempt of $100.25, since that transaction was rejected due to insufficient funds. Also note that the account's current balance should match that of the balance following the last transaction (Withdraw, 5.25), which left a $5.25 balance. Output When given a printing command (and they can appear anywhere in the file), you should print a full "data" dump of the specified object. That is, all values of all of the object's fields should be printed to the screen. If the account does not exist, then the program should skip printing anything for that print command. Please use an abbreviated notation as follows. Note that this example is not related to any particular account from the input file. Here, "sam" is the name of the account, 123 is the account number, $52.55 is the current balance (at the time of the print command), and the list of transactions (up to the point when the print command is executed) is a $100.00 deposit, $50.00 withdrawal, $10.00 withdrawal, and $12.55 deposit. Note that we are using the +1 - notation to indicate deposit and withdrawal transactions and that the list notation is printed as well. Do not introduce a second transaction list in the Account object to track this printing (printing is not a transaction). Final Thoughts We expect to see functions used in your solution. The number of functions and their actions is up to you, but you should conslder keeping them capped at 10-15 Ines of code (50 they are smallish and do very specific functionality. We expect to see NO single letter variable names anywhere in the solution. This includes loop varlables. Plck variable and function names that are understandable, not acronyms, and clearly elucldate the purpose of the variable or function. This includes flelds and methods in the Account class. Consider writing your own input fle to rigorously test your program. But, let's keep the name of the Input flle to be "transactions.txt". This makes it easy to swap in other input fles (mine, yours), and if we "hard code" the name of the flle into the program, we dont need to prompt the user for the flle name when the program is run. Feel free to trade input flles and output flles collectively as a group. Consider utilizing the Brightspace discussion board to do so. Be sure to add appropriate error handing in the program. This should Include when you are flle processing (obviously], but when you read the Input from the file and attempt to convert it to other types! In fact, be sure to rigorously test input processing. What if I don't give you a float for a transaction amount? What if I glve you a string for an account number? Etc. Thinking about and planning for input issues is part of professional programming. Grading Rubric Note that the below Ilst should give you an Idea of the major areas of the program where we will be looking to grade. It does not Include everything. For example, we reserve the right to deduct for single letter variables, or fallure to use functions, etc. - [5 points] - Uses a main function and the Pythonic way of starting a program (if name m=1main_7:main()) - [20 points] - Input processing [10 points] Correctly opens and reads input file transactions.txt' [5 points] Contains proper error handing for flle inputioutput [5 points] Closes the input file - [15 point8] - OOP Design - [15 points] - Account objects as detalled above (contalns a string, an int, a float, and a llst of tuples (transactions)] - [60 points] - Command Processing - [15 points] - Account - creates new account ob]ects - [15 points] - Deposit - deposits specilied amount to corresponding account, modifying that Account object - [15 points] - Withdraw - withdrawal of specifled amount from corresponding account, modifying that Account object - [15 points] - Print - prints the detals of an account as specified above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago