Giter Site home page Giter Site logo

bankversion1's Introduction

#BankVersion1

Exercise 11

Download or clone the C# project BankVersion1. This exercise is about defining a new class yourself! In the project, there is a file called BankAccount.cs, containing a definition of a class BankAccount. However, the definition is empty…

We have to fill out the class definition. The requirements to the bank account class are the following:

  • It must have a name, which is the name of the account holder
  • It must have a balance, which is a decimal number.
  • It must have a method Deposit, which you can use for depositing an amount to the account (that is, the balance should increase
  • It must have a method Withdraw, which you can use for withdrawing an amount from the account (that is, the balance should decrease)
  • It must have methods for returning the value of the account holder name, and the value of the balance (one method for each value)

Given these requirement, your tasks are:

  1. Fill out the BankAccount definition, such that all requirements are fulfilled. This includes definition of instance fields, constructors and methods.

  2. Make some test code that tests your BankAccount class. That is, you should create a BankAccount object, call the withdraw/deposit methods, and use the available methods to check that the object behaves as expected with regards to the value of the balance.

  3. If you have time left, try to extend the class definition with methods for adding interest to the account. It is up to you to define requirements, etc..

NOTE: This is a fairly large and somewhat difficult exercise. Try to solve it in small steps – get a little bit to work, test it, and then proceed to the next little bit. Manage the complexity!

bankversion1's People

Contributors

martinkierkegaard avatar

Watchers

James Cloos 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.