Question

this is the question, please help me with this python coding question thanks and appreciate your help

1. Create an object call Accounts. This is to be used in a banking system. 2. Initialize the account with three data as input

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question.

Here is the completed code for this problem.  Let me know if you have any doubts or if you need anything to change. Screenshot attached for both code and output.

Thank You !!

================================================================================================

class Accounts():

    def __init__(self,firstName,lastName,balance):
        self.first_name = firstName
        self.last_name = lastName
        self.balance = balance

    def withdraw(self, amount):
        if amount<=self.balance and amount>0:
            self.balance-=amount
            print('Amount ${0} withdrawn from account successfully.'.format(amount))
            self.feeCalculation()
        else:
            print('You dont have sufficient balance. Withdraw amount must be less than account balance')

    def deposit(self,amount):
        if amount>0 :
            self.balance+=amount
            print('Amount ${0} deposited to account successfully.'.format(amount))
            self.feeCalculation()
        else:
            print('Entered deposit amount is invalid')

    def feeCalculation(self):
        if self.balance<1000:
            self.balance-=10
            print('$10 was deducted as the total amount in the account is less than $1000')

    def addInterest(self):
        self.balance += self.balance*0.03
        print('Interest added to balance.')

    def __str__(self):
        return 'Name: {0} {1}, Account Balance: ${2:.2f}'.format(self.first_name,self.last_name,self.balance)

def main():

    account = Accounts('Marsha','Walker',750)
    print(account)
    account.deposit(200)
    print(account)
    account.withdraw(1000)
    print(account)
    account.withdraw(240)
    print(account)
    account.addInterest()
    print(account)


main()

==========================================================================================

Add a comment
Know the answer?
Add Answer to:
this is the question, please help me with this python coding question thanks and appreciate your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT