Giter Club home page Giter Club logo

bankaccounts's Introduction

Bank Accounts

We will be working with the concept of bank accounts in order to explore more object-oriented code as well as a few other new topics.

Baseline Setup

  1. This is an individual, stage 1 project.
  2. Fork the project master.
  3. Clone the forked repo: $ git clone [YOUR FORKED REPO URL]
  4. cd into the dir create:d $ cd BankAccounts
  5. Run git remote -v to verify the folder you are in corresponds to the fork you have created.
  6. Run gem install minitest-skip to install an extra gem for testing (more on what this actually does later).

Testing

This is our first project with real tests! Following the instructions from the TDD lecture, there are three things in our project directory:

Rakefile
lib/
specs/

Each class you write (there will only be one until wave 3) should get its own file, lib/class_name.rb. The specs for that class will be in specs/class_name_spec.rb, and you can run all specs using rake.

For wave 1, all tests will be given to you - your job is to write code to make them pass. For waves 2 and 3, we supply descriptions of the tests, but you have to write them yourself.

Wave 1

Learning Goals

  • Create a class inside of a module
  • Create methods inside the class to perform actions
  • Learn how Ruby does error handling
  • Verify code correctness by testing

Requirements

Create a Bank module which will contain your Account class and any future bank account logic.

Create an Account class which should have the following functionality:

  • A new account should be created with an ID and an initial balance
  • Should have a withdraw method that accepts a single parameter which represents the amount of money that will be withdrawn. This method should return the updated account balance.
  • Should have a deposit method that accepts a single parameter which represents the amount of money that will be deposited. This method should return the updated account balance.
  • Should be able to access the current balance of an account at any time.

Error handling

  • A new account cannot be created with initial negative balance - this will raise an ArgumentError (Google this)
  • The withdraw method does not allow the account to go negative. Instead it will output a warning message and return the original un-modified balance.

Optional:

Make sure to write tests for any optionals you implement!

  • Create an Owner class which will store information about those who own the Accounts.
    • This should have info like name and address and any other identifying information that an account owner would have.
  • Add an owner property to each Account to track information about who owns the account.
    • The Account can be created with an owner, OR you can create a method that will add the owner after the Account has already been created.

bankaccounts's People

Contributors

botrethewey avatar cheezitman avatar jnf avatar kariabancroft avatar susanev avatar

Watchers

 avatar

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.