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

1 Expert Approved Answer
Step: 1 Unlock

Heres a simple implementation of the BankAccount class in Python along with a BankRunner class for t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!