(Account Inheritance Hierarchy) Create an inheritance hierarchy that a bank might use to represent customer bank accounts. All customers at this bank can deposit money into their accounts and withdraw money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, don't earn interest and charge a fee per transaction. Start with class Account from this chapter and create two subclasses Savings Account and CheckingAccount. A Savings Account should also include a data attribute indicating the interest rate. A Savings Account's calculate_interest method should return the Decimal result of multiplying the interest rate by the account balance. Savings Account should inherit methods deposit and withdraw without redefining them. A CheckingAccount should include a Decimal data attribute that represents the fee charged per transaction. Class CheckingAccount should override methods deposit and withdraw so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these methods should invoke the base-class Account versions to update the account balance. CheckingAccount's withdraw method should charge a fee only if money is withdrawn (that is, the withdrawal amount does not exceed the account balance). Create objects of each class and tests their methods. Add interest to the SavingsAccount object by invoking its calculate_interest method. then passing the returned interest amount to the object's deposit method.
(Account Inheritance Hierarchy) Create an inheritance hierarchy that a bank might use to represent customer bank accounts. All customers at this bank can deposit money into their accounts and withdraw money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, don't earn interest and charge a fee per transaction. Start with class Account from this chapter and create two subclasses Savings Account and CheckingAccount. A Savings Account should also include a data attribute indicating the interest rate. A Savings Account's calculate_interest method should return the Decimal result of multiplying the interest rate by the account balance. Savings Account should inherit methods deposit and withdraw without redefining them. A CheckingAccount should include a Decimal data attribute that represents the fee charged per transaction. Class CheckingAccount should override methods deposit and withdraw so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these methods should invoke the base-class Account versions to update the account balance. CheckingAccount's withdraw method should charge a fee only if money is withdrawn (that is, the withdrawal amount does not exceed the account balance). Create objects of each class and tests their methods. Add interest to the SavingsAccount object by invoking its calculate_interest method. then passing the returned interest amount to the object's deposit method.
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...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY