Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve using PYTHON: Bank Accounts (100 points) Define an Account class Define protected class variables to store the following Account holders name as string balance

Solve using PYTHON:

Bank Accounts (100 points)

  1. Define an Account class
    1. Define protected class variables to store the following
      1. Account holders name as string
      2. balance as float
      3. transaction counter as integer
    2. Define the following methods
      1. A constructor (__init__) that accepts the following values and populates appropriate class variables
        1. account holders name
        2. starting balance
      2. deposit(float)
        1. accepts a floating-point number and adds it to the balance
        2. increments the transaction counter
        3. returns the current balance
      3. withdraw(float)
        1. If the balance of the account is sufficient to withdraw funds; subtract amount from balance and return the new balance, increment the transaction counter
        2. If the balance in the account is insufficient, do not subtract the amount and return False, do not increment the transaction counter
      4. overload len()
        1. When an Account object is used as an argument to len(), return the transaction count
      5. overload str()
        1. When an Account object is passed to str(), return the account holders name
      6. overload the equivalence operator
        1. When your Account class is used with an equivalence operator "==" compare the balance in both accounts and return True if they are equal, False if they are not equal
    3. Define a CreditAccount class that inherits from Account
      1. Add the following private class variable
        1. limit
        2. rate
      2. Override the constructor to only accept an account name
        1. the starting balance of CreditAccount should always be 0
        2. Set the limit to 1000.00 and the rate to 1.24
      3. Override the deposit method
        1. Accept a float as a single argument
        2. Subtract the amount from balance and return the new balance
          1. If subtracting the amount results in a negative number; set the balance to 0.0
        3. do not increment the transaction counter
        4. return the new balance
      4. Override the withdraw function
        1. Accept a float as a single argument
        2. If the current account balance plus this new amount is less than limit
          1. multiply the amount by the rate and add the result to balance
          2. increment the transaction counter
          3. return the new balance
        3. If the balance plus this new amount is equal to or greater than limit
          1. return False
          2. do not increment the transaction counter
    4. Define a SavingsAccount
      1. Override the Deposit function
        1. On every deposit, multiply the amount by 1.05 before adding it to balance
        2. increment the transaction counter by 1
        3. return the new balance
      2. define a function called accrue
        1. does not take any arguments from the caller
        2. multiplies the balance by 1.05
        3. does not increment the transaction counter
        4. returns the new balance

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How do you talk about your complaining customers?

Answered: 1 week ago