Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Computer Networking: A Top-Down Approach (7th Edi...
    Computer Engineering
    ISBN:9780133594140
    Author:James Kurose, Keith Ross
    Publisher:PEARSON
    Text book image
    Computer Organization and Design MIPS Edition, Fi...
    Computer Engineering
    ISBN:9780124077263
    Author:David A. Patterson, John L. Hennessy
    Publisher:Elsevier Science
    Text book image
    Network+ Guide to Networks (MindTap Course List)
    Computer Engineering
    ISBN:9781337569330
    Author:Jill West, Tamara Dean, Jean Andrews
    Publisher:Cengage Learning
    Text book image
    Concepts of Database Management
    Computer Engineering
    ISBN:9781337093422
    Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
    Publisher:Cengage Learning
    Text book image
    Prelude to Programming
    Computer Engineering
    ISBN:9780133750423
    Author:VENIT, Stewart
    Publisher:Pearson Education
    Text book image
    Sc Business Data Communications and Networking, T...
    Computer Engineering
    ISBN:9781119368830
    Author:FITZGERALD
    Publisher:WILEY