Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment Build a class called BankAccount that manages checking and savings accounts. The class has three attributes: a customer name, the customer's savings account balance,
Assignment
Build a class called BankAccount that manages checking and savings accounts. The class has three attributes: a customer name, the customer's savings account balance, and the customer's checking account balance.
Implement the following constructor and instance methods as listed below:
Constructor with parameters self newname, checkingbalance, savingsbalance set the customer name to parameter newname, set the checking account balance to parameter checkingbalance, and set the savings account balance to parameter savingsbalance.
depositcheckingself amount add parameter amount to the checking account balance only if positive
depositsavingsself amount add parameter amount to the savings account balance only if positive
withdrawcheckingself amount subtract parameter amount from the checking account balance only if positive
withdrawsavingsself amount subtract parameter amount from the savings account balance only if positive
transfertosavingsself amount subtract parameter amount from the checking account balance and add to the savings account balance only if positive
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started