Giter VIP home page Giter VIP logo

design-by-contract's Introduction

Design-by-Contract

Introduction

Consider an Account class. It should have two methods:

  • Deposit(double amount) which should increase the account’s balance with the amount, the amount should always be positive

  • Withdraw(double amount) which on the other hand should decrease the account’s balance.

Also this amount should be positive. If the amount exceeds the balance, the balance should be left untouched and an exception should be thrown.

Assignment

Create a C# class that implements the behaviour mentioned in 1 Introduction. Use Code Contracts to enforce Design by ContractTM principles. Also create a small program, that uses the account class. The report should besides from a git url to the project include a short textual description on how the code contract should be interpreted. Hand in A link to the github repository including a short textual description on how the code contract should be interpreted (README.md). In groups on peergrade by TBD

Install guide

  • Download Visuel studio 15 (requried 2017/2019 does not support code contracts)
  • Download project.
  • Open project with visuel studio 15.

Run program

  1. Look in Account class and see how code contact is implemented.

  2. in the class, program, outcomment the example you would like to se run and run it. have fun :)

design-by-contract's People

Contributors

jonasmanley avatar dunkring avatar

Watchers

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