In: Computer Science
Create an object call Accounts using python for a banking
system.
Initialize the account with three data as inputs : Firstname,
Lastname and initial deposit. Create 4 additional member functions:
Deposit, Withdraw, Fee Calculations, interest
The fee calculation is going to be $14 per month if the total
amount in the account is less than $1000. Interest is set to be at
5%.
class Accounts:
interest = 0
fee = 0
def __init__(self, FirstName, LastName,
initial_deposit):
self.FirstName = FirstName
self.LastName = LastName
self.balance =
initial_deposit
def Deposit(self, balance):
self.balance += balance
print("successfully deposited
amount current balance is {}".format(balance))
def Withdraw(self, balance):
if(self.balance <
balance):
print("insufficent amount")
else:
self.balance -=
balance
print("successfully withdrawn amount current balance is
{}".format(balance))
def FeeCalculation(self, time_in_years):
if(self.balance < 1000):
self.fee += 14 *
12 * time_in_years
self.Interest()
else:
self.interest =
0
print("There is
no fee")
def Interest(self):
self.interest = 5
person1 = Accounts("firstname1", "lastname1",2000)
person2 = Accounts("firstname2", "lastname2",1000)
person3 = Accounts("firstname3", "lastname3", 500)
person4 = Accounts("firstname4", "lastname3", 5000)
print(person1.balance)
person3.FeeCalculation(1)
print(person3.fee)
print(person3.interest)
person3.Deposit(1000)
person3.FeeCalculation(1)
person4.Withdraw(3000)
print(person4.balance)
print(person2.interest)
If you have any doubts please comment and please don't dislike.