edit project

Description

Having Trouble Meeting Your Deadline?

Get your assignment on edit project  completed on time. avoid delay and – ORDER NOW

I have this code:

# Description:Bank Customer Account Management System

# FUNTION TO RETURN THE ACCOUNT NUMBER FROM A LINE

def get_number(one_line):

return one_line[:6]

# FUNTION TO RETURN THE BALANCE FROM A LINE

def get_balance(one_line):

balance_str = one_line[7:17].strip() # Extract the balance string and remove leading/trailing spaces

return float(balance_str)

# FUNTION TO RETURN THE ACCOUNT NAME FROM A LINE

def get_name(one_line):

name_str = one_line[17:].strip() # Extract the name string and remove leading/trailing spaces

return name_str

# MAIN FUNTION TO PROCESS CUSTOMER TRANSACTIONS

def main():

# ASK THE FILE NAME

fileName = input(‘Enter a file prefix: ‘)

#TRY TO OPEN THE FILE

try:

#OPEN THE INPUT FILE FOR READING

input_file = open(fileName + ‘_old.txt’, ‘r’)

# OPEN THE INPUT FILE FOR APPEND WITH CREATE

output_file = open(fileName + ‘_new.txt’, ‘a+’)

#READ THE FIRST LINE

line = input_file.readline()

#READS TILL 999999

while line.strip() != ‘999999’:

# GETS NUMBER,NAME,BALANCE USING FUNTIONS CREATED

number = get_number(line)

name = get_name(line)

balance = get_balance(line)

#TO CHECK IF CURRENT ACCOUNT CAN BE ADDED TO NEW RECORD

can_add = True

# PRINT CURRENT DETAILS

print(f’verifying input: {number} {balance} {name}’)

#HOLDS THE COMMAND

command = ”

# REPEATS UNLESS USER TYPES A OR C

while True:

# ASK THE COMMAND

command = input(‘Enter a command (a,c,d,w): ‘)

# A TO ADD

if command == ‘a’:

break

# C TO CLOSE

elif command == ‘c’:

# CHECK IF NO BALANCE,THEN CLOSE,OTHERWISE SHOW ERROR

if balance > 0:

print(‘Account not closed because money is still in it.’)

continue

else:

can_add = False

print(‘Account is closed’)

break

# D FOR DEPOSIT

elif command == ‘d’:

amount = 0

while amount <= 0:

try:

amount = float(input(‘Enter deposit amount: ‘))

if amount <= 0:

print(‘INVALID INPUT: Please enter a numeric value greater than 0.’)

except ValueError:

print(‘INVALID INPUT: Please enter a numeric value. ‘)

balance += amount

# D FOR WITHDRAWL

elif command == ‘w’:

# VALIDATION LOOP

while True:

try:

amount = float(input(‘Enter withdrawal amount: ‘))

break

# IF USER ENTERS OTHER THAN NUMBERS

except ValueError:

print(‘Withdrawal amount should be a number!’)

# REMOVE FROM BALANCE

balance -= amount

#FOR WRONG COMMANDS

else:

print(f’Entered an invalid command {command}’)

#ADD TO FILE AND PRINT THE NEW BALANCE

if can_add:

print(f’New balance: {number} {balance} {name}’)

output_file.write(f'{number:6} {balance:10.2f} {name}n’)

#READ THE NEW LINE

line = input_file.readline()

#WRTIE THE LAST LINE AS 999999

output_file.write(‘999999n’)

# IF FILE DOESN’T EXIST SHOW ERROR

except FileNotFoundError:

print(f’The file name {fileName}_old.txt does not exist’)

# CALL THE MAIN FUNTION

if __name__ == ‘__main__’:

main()

this must be the ouputEnter a file prefix: customers

Verifying input: 100000 43736.57 Rossum, Guido V.

Enter a command (a,c,d,w): w

Enter withdrawal amount: 1000.00

Enter a command (a,c,d,w): K

Entered an invalid command K.

Enter a command (a,c,d,w): w

Enter withdrawal amount: 500.50

Enter a command (a,c,d,w): d

Enter deposit amount: Two Hundred

INVALID INPUT: Please enter a numeric value.

Enter deposit amount: -1.2

INVALID INPUT: Please enter a numeric value greater than 0.

Enter deposit amount: 200.00

Enter a command (a,c,d,w): a

New balance: 100000 42436.07 Rossum, Guido V.

Verifying input: 100789 5681745.99 Eich, Brendan

Enter a command (a,c,d,w): a

New balance: 100789 5681745.99 Eich, Brendan

Verifying input: 320056 5.01 Ritchi, Dennis MacAlistair.

Enter a command (a,c,d,w): w

Enter withdrawal amount: 5.00

Enter a command (a,c,d,w): c

Account not closed because money is still in it.

Enter a command (a,c,d,w): w

Enter withdrawal amount: 0.01

Enter a command (a,c,d,w): c

Account is closed

Enter a command (a,c,d,w): a

New balance: 320056 0.00 Ritchi, Dennis MacAlistair.

Verifying input: 650430 2398.12 Wall, Larry

Enter a command (a,c,d,w): a

New balance: 650430 2398.12 Wall, Larry ,,,,,,

but the last part doesn’t show in my project,I mean this part to the end..please correct the code so that the last part can be in the code

Enter a command (a,c,d,w): a

New balance: 320056 0.00 Ritchi, Dennis MacAlistair.

Verifying input: 650430 2398.12 Wall, Larry

Enter a command (a,c,d,w): a

Explanation & Answer

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Order Now and we will direct you to our Order Page at Litessays. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

Similar Posts