Question
Create a 'Bankccount' class. This will be a representation of an overly simplified version of a person's bank account. Each Bankccount object should have instance
Create a 'Bankficcount' class. This will be a representation of an overly simplified version of a person's bank account. Each Bankflccount object should have instance variables for the person's 'name' and their current account 'balance'. You will need to make a constructor that takes in both the person's name and their starting balance, which can be used to set the instance variables. You will need to make getters' for each instance variable. Implement a 'withdraw' that takes an 'amount' as a parameter. This method will decrease the person's balance by the amount, however, if this will make their account negative do not do the decreasing. Develop a 'deposit' method that takes an 'amount' as a parameter. This method will increase the person's balance by the amount, however, it should only allow positive numbers so the balance is actually increased. Finally, provide a new implementation for the 'toString' method that will display the person's account details in a user-friendly manner. Create a 'BankRunner' class that makes BankAccount objects and test various method calls. 1. 'setters'
Step by Step Solution
3.34 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
Heres a simple implementation of the BankAccount class in Python along with a BankRunner class for t...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