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
  • Could someone help me and show how to the calculations/answer for this question. Appreciate your help!...

    Could someone help me and show how to the calculations/answer for this question. Appreciate your help! Suppose you want to have $1,000,000 in 35 years. Calculate how much you need to deposit per month in an account that pays 9.3% per month, compounded monthly

  • this is a python question please help me with this code thank you and appreciate it...

    this is a python question please help me with this code thank you and appreciate it 1. Write a Boolean function between that takes two My Time objects, t1 and t2, as arguments, and returns True if the invoking object falls between the two times. Assume t1 <= t2, and make the test closed at the lower bound and open at the upper bound, i.e. return True if t1 <= obj <t2. 2. Turn the above function into a method...

  • Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the...

    Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...

  • Please help JAVA Part II: Programming Module (80 marks): Write a banking program that simulates the operation of your l...

    Please help JAVA Part II: Programming Module (80 marks): Write a banking program that simulates the operation of your local bank. You should declare the following collection of classes: 1) An abstract class Customer: each customer has: firstName(String), lastName (String), age (integer), customerNumber (integer) - The Class customer has a class variable lastCustomerNumber that is initialized to 9999. It is used to initialize the customerNumber. Hence, the first customer number is set to 9999 and each time a new customer...

  • this question is about the coding theory. Please help me for this problem with explainations, thanks...

    this question is about the coding theory. Please help me for this problem with explainations, thanks for your help! encoded À (1.4) code. [m ma m3 ma] [m, ma M3 M4 mi ma m] (1) what is & matrix ? (t) What is it matrix? is what is dmin!

  • Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and...

    Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings), this includes a GUI user interface that allows user to login, and deposit or withdraw, and application to display the transaction and final balance. All the bank customers can: - Create a new account - Deposit (Credit) money into their account and/or withdraw (debit) money from their account. - Application should expect user to login to their account using login/password Create necessary classes...

  • C++ Question Modify the class by changing private members to protected members and viewing Account class...

    C++ Question Modify the class by changing private members to protected members and viewing Account class as a base class. Define two derived classes Checking and RRSP. The Checking class has one additional private data: total(double). It has five public member functions: a constructor Checking (string n, string addr, double b, int p, double tot) (note you must call base constructor by using initialization list), double getTotal() to return total, void setTotal() to updata data, void withdraw(double w) which requires...

  • This is Python Coding question. Can anyone help me figuring these out? (Please don't use built-in...

    This is Python Coding question. Can anyone help me figuring these out? (Please don't use built-in function, and leave comments for my understanding) Thanks!! 1. Write a function called span(n) that takes as a parameter a 2D list of numbers called n and returns the difference between the largest and smallest number in n. For example, it should return the value 6 for the list [[2, 1, 3],[3, 7, 4]] since the largest number is 7 and the smallest is...

  • Please show it in C++. Thank you! Problem Definition Create an inheritance hierarchy containing base class...

    Please show it in C++. Thank you! Problem Definition Create an inheritance hierarchy containing base class Account and derived class Savings-Account. Base class Account should include one data member of type double to represent the account balance. The class should provide a constructor that receives an initial baiance and uses it to initialize the data member. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money...

  • In C++ Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at this bank can deposit (i.e., credit) money into their accounts and withdraw (i.e.,...

    In C++ Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at this bank can deposit (i.e., credit) money into their accounts and withdraw (i.e., debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction (i.e., credit or debit). Create an inheritance hierarchy containing base class Account and derived...

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