Code Monkey home page Code Monkey logo

c3projects--bankaccounts's Introduction

Bank Accounts

Breakfast

Create an Account class with a minimum of 6 specs. The class should have the following methods:

  • self.new(id, initial_balance): creates a new instance with the instance variable id and 'initial_balance' assigned
    • Account cannot be created with initialize negative balance - this will raise an ArgumentError (Google this)
  • #withdraw(amount): The input amount gets taken out of the account as result of an ATM transaction. Return value should be the updated account balance.
    • Does not allow the account to go negative - Will output a warning message and return the original un-modified balance
  • #deposit(amount): Adds the input amount to the account balance as a result of an ATM transaction. Return value should be the updated account balance
  • #balance: Returns the current account balance

Create a SavingsAccount class with a minimum of 6 specs. The class should inherit behavior from the Account class. It should include updated logic within the following methods:

  • self.new(id, initial_balance): creates a new instance with the instance variable id and 'initial_balance' assigned
    • The initial balance cannot be less than $10. If it is, this will raise an ArgumentError
  • #withdraw(amount): The input amount gets taken out of the account as result of an ATM transaction. Each withdrawal 'transaction' incurs a fee of $2 that is taken out of the balance.
    • Does not allow the account to go below the $10 minimum balance - Will output a warning message and return the original un-modified balance

It should include the following new methods:

  • #add_interest(rate): Calculate the interest on the balance and add the interest to the balance. Return the interest that was calculated and added to the balance (not the updated balance).
    • Input rate is assumed to be a percentage (i.e. 0.25).
    • The formula for calculating interest is balance * rate/100
      • Example: If the interest rate is 0.25% and the balance is $10,000, then the interest is $25 and the new balance becomes $10,025.

Lunch

Create a CheckingAccount class with a minimum of 6 specs. The class should inherit behavior from the Account class.

  • #withdraw(amount): The input amount gets taken out of the account as result of an ATM transaction. Each withdrawal 'transaction' incurs a fee of $1 that is taken out of the balance. Returns the updated account balance.
    • Does not allow the account to go negative. Will output a warning message and return the original un-modified balance
  • #withdraw_using_check(amount): The input amount gets taken out of the account as a result of a check withdrawal. Returns the updated account balance.
    • Allows the account to go into overdraft up to -$10 but not any lower
    • The user is allowed three free check uses in one month, but any subsequent use adds a $2 transaction fee
  • #reset_checks: Resets the number of checks used to zero

Dinner

Create a MoneyMarketAccount class with a minimum of 6 specs. The class should inherit behavior from the Account class.

  • A maximum of 6 transactions (deposits or withdrawals) are allowed per month on this account type
  • self.new(id, initial_balance): creates a new instance with the instance variable id and 'initial_balance' assigned
    • The initial balance cannot be less than $10,000 - this will raise an ArgumentError
  • #withdraw(amount): The input amount gets taken out of the account as result of an ATM transaction. Returns the updated account balance.
    • If a withdrawal causes the balance to go below $10,000, a fee of $100 is imposed and no more transactions are allowed until the balance is increased using a deposit transaction.
    • Each transaction will be counted against the maximum number of transactions
  • #deposit(amount). Returns the updated account balance.
    • Each transaction will be counted against the maximum number of transactions
    • Exception to the above: A deposit performed to reach or exceed the minimum balance of $10,000 is not counted as part of the 6 transactions.
  • #add_interest(rate): Calculate the interest on the balance and add the interest to the balance. Return the interest that was calculated and added to the balance (not the updated balance). Note** This is the same as the SavingsAccount interest.
  • #reset_transactions: Resets the number of transactions to zero

c3projects--bankaccounts's People

Contributors

jnf avatar kariabancroft avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c3projects--bankaccounts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.