Bank Accounts (Use Python) Write a program that accepts bank transactions and prints out the balance of an account afterwards. PROGRAM DESIGN Create a class named bankAccount. A bank account should have the following attributes: accNumber, balance, and dateOpened. This class should also have the option to do the following transactions: deposit, withdraw and drop. Initially there is only one bankAccount active in the program, with a balance amount of 1515, and was opened back in 10/01/1987. Depositing adds to a current bankAccount’s balance, while withdrawing – does otherwise. Dropping would equate the current balance to zero. Refer to the following class diagram for more details about the current bankAccount: bankAccount accNumber = 1 balance = 1515 dateOpened = "10/27/1987" deposit(dep) withdraw(wd) drop(accNumber)   INPUT The input would be a string that contains the following data: the transaction to be done (dep – for deposit, wd – for withdraw and drop – for drop), the accNumber, and how much to be withdraw or deposited (0 if drop is involved). These data are separated by spaces. OUTPUT Once the user enters the input, the program should be print an output based on the transaction and the amount provided by the user. However, if the user misspells or enters a non-existent transaction, or inputs a non-existent account number, the text “Invalid Transaction!” should be displayed.   SAMPLE INPUT dep 1 1000 wd 1 1516 drop 1 0 depo 1 21000 drop 2 2000 SAMPLE OUTPUT 2515 -1 0 Invalid Transaction! Invalid Transaction!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Bank Accounts (Use Python)


Write a program that accepts bank transactions and prints out the balance of an account afterwards.

PROGRAM DESIGN


Create a class named bankAccount. A bank account should have the following attributes: accNumber, balance, and dateOpened. This class should also have the option to do the following transactions: deposit, withdraw and drop. Initially there is only one bankAccount active in the program, with a balance amount of 1515, and was opened back in 10/01/1987.

Depositing adds to a current bankAccount’s balance, while withdrawing – does otherwise. Dropping would equate the current balance to zero. Refer to the following class diagram for more details about the current bankAccount:

bankAccount
accNumber = 1
balance = 1515
dateOpened = "10/27/1987"


deposit(dep)
withdraw(wd)
drop(accNumber)

 

INPUT
The input would be a string that contains the following data: the transaction to be done (dep – for deposit, wd – for withdraw and drop – for drop), the accNumber, and how much to be withdraw or deposited (0 if drop is involved). These data are separated by spaces.

OUTPUT
Once the user enters the input, the program should be print an output based on the transaction and the amount provided by the user. However, if the user misspells or enters a non-existent transaction, or inputs a non-existent account number, the text “Invalid Transaction!” should be displayed.

 

SAMPLE INPUT

dep 1 1000
wd 1 1516
drop 1 0
depo 1 21000
drop 2 2000

SAMPLE OUTPUT

2515
-1
0
Invalid Transaction!
Invalid Transaction!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY