Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For your final challenge in this unit, you will load two files. The first file F1 will have information about some accounts. It will be

For your final challenge in this unit, you will load two files. The first file F1 will have information about some accounts. It will be piped-delimited and have one record per line, with these fields:
ACCOUNT NUMBER|PIN CODE|BALANCE
The second file F2 will contain instructions: one on each line. The instructions will look like this.
COMMAND|AMOUNT|ACCOUNT NUMBER|PIN CODE
COMMAND will be either add or sub. If the command is add, You will add AMOUNT to the BALANCE in the account files F1. If the COMMAND is sub you will subtract.
However there are a number of reasons for which you may need to reject the transaction. If you are asked to subtract an amount that would put the amount below zero or if the pin code you are provided does not match the pin code in the account record, the transaction is ignored.
Given pipe-delimited files F1 and F2 where F1 contains accounts with fields Account NUM|PIN|BALANCE and F2 contains transaction instructions COMMAND|AMOUNT|ACCOUNT NUM|PIN, execute the transactions, storing the results back in F1
The COMMAND field will be add or sub indicating addition or subtraction from the account.
Transactions which do not provide the correct PIN code or attempt to put the account below zero should be ignored.
image text in transcribed
bank-transac # Get the filepath from the command line import sys F1= sys.argv [1] F2- sys.argv[21 2 5 6 # Your code goes here

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

Students also viewed these Databases questions